Click Event

                          

Occurs in one of two cases:

Syntax

For MultiPage, TabStrip
Private Sub object_Click( index As Long)

For all other controls
Private Sub object_Click( )

The Click event syntax has these parts:

Part Description
object Required. A valid object.
index Required. The index of the page or tab in a MultiPage or TabStrip associated with this event.

Remarks

Of the two cases where the Click event occurs, the first case applies to the CommandButton, Frame, Image, Label, ScrollBar, and SpinButton. The second case applies to the CheckBox, ComboBox, ListBox, MultiPage, TabStrip, and ToggleButton. It also applies to an OptionButton when the value changes to True.

The following are examples of actions that initiate the Click event:

When the Click event results from clicking a control, the sequence of events leading to the Click event is:

  1. MouseDown

  2. MouseUp

  3. Click

For some controls, the Click event occurs when the Value property changes. However, using the Change event is the preferred technique for detecting a new value for a property. The following are examples of actions that initiate the Click event due to assigning a new value to a control:

The Click event is not initiated when Value is set to Null.

Note   Clicking changes the value of a control, thus it initiates the Click event. When you right-click, the value of the control does not change, so it does not initiate the Click event.