Cannot set a custom MousePointer
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Cannot set a custom MousePointer

Visual Studio .NET 2003

In Visual Basic 6.0, you could specify a custom mouse pointer by assigning an image to the MouseIcon property of a form or control and setting the MousePointer property to vbCustom or 99. Custom mouse pointers are not supported at design time in Visual Basic .NET; the MousePointer property is replaced by the Cursor property, and the MouseIcon property no longer exists.

Note   The Cursor property can be set at run time to any value of type System.Windows.Forms.Cursor.

The following code set a custom mouse pointer in Visual Basic 6.0:

' Visual Basic 6.0
PictureBox1.Mousepointer = vbCustom

What to do next

  • If the custom mouse pointer was set at design time, choose a new mouse pointer by selecting the Cursor property in the Properties window for the form or control.
  • If the custom mouse pointer was set in code, modify your code to use the Cursor property. You can view a list of available cursors in the Properties window by selecting the Cursor property for any form or control.

    For example, to use the Hand cursor in a PictureBox control, enter the following code:

    ' Visual Basic .NET
    PictureBox1.Cursor = System.Windows.Forms.Cursors.Hand

See Also

Control Changes in Visual Basic .NET | UserControl Changes in Visual Basic .NET

© 2016 Microsoft