How to Set Hourglass MousePointer in VB Program During Delays

ID Number: Q71105

1.00

MS-DOS

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.

This information applies to Microsoft Visual Basic Programming System

version 1.00 for Windows.

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. 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