Cannot set a custom MousePointer

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


The Cursor property can be set at run time to any value of type Cursor.

The following code sets a custom mouse pointer in Visual Basic 6.0.

PictureBox1.Mousepointer = vbCustom

What to do next

  • If the custom mouse pointer is 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 is different from those available at design time, you will need to set it programmatically.

  • If the custom mouse pointer is set in code, modify your code to use the Cursor property. Any cursor (.cur) file can be used; icon (.ico) files are no longer supported.

    For example, to use a custom hand cursor in a PictureBox control, enter the following code.

    PictureBox1.Cursor = New _ System.Windows.Forms.Cursor("C:\mypath\mycursor.cur")

See Also


User Controls for Visual Basic 6.0 Users

MousePointer for Visual Basic 6.0 Users

Other Resources

Windows Forms Controls for Visual Basic 6.0 Users