How to Set Hourglass MousePointer in VB Program During Delays (71105)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Visual Basic Standard Edition for Windows 1.0

This article was previously published under Q71105

SUMMARY

During operations that take time, you may decide to display the hourglass mouse cursor. This will let the user know that the computer is performing an operation that may take some noticeable time, and that no user input will be immediately processed during this time.

MORE INFORMATION

The MousePointer property can be set during design time or during run time. During operations that may take some noticeable amount of time, the MousePointer should be set to the hourglass pointer. This can be performed using the Screen.MousePointer property. Before setting the mouse pointer to the hourglass, you should save the present mouse pointer so that when you are through with the hourglass cursor, you can re-initialize it to the previous pointer. Listed below is an example of setting the pointer to the hourglass cursor:
Sub Form_Click ()
   SavedPointer = Screen.MousePointer  ' Save mouse pointer.
   Screen.MousePointer = 11            ' 11# = hourglass.
   For i = 1 To 10000: Next i          ' Some lengthy operation.
   Screen.MousePointer = SavedPointer  ' Set to previous mouse pointer.
End Sub
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB71105