Click
This event occurs when a user presses and then releases the button of mouse device over an object. It also occurs when you change the value of a control.
Syntax
Private Sub object_Click( )
Parameters
- object
- Object expression that evaluates to a control or Form object.
Remarks
If the Click event contains code, the Click event intercepts the click of the mouse device, and the DblClick event does not occur.
For a Form object, the DlbClick event occurs when the user chooses either a blank area or a disabled control. For an intrinsic control, this event occurs when the user performs any of the following actions:
- Clicks a control with the left or right button of a mouse device. With a CheckBox, CommandButton, Listbox, or OptionButton control, the Click event occurs only when the user clicks the left button of a mouse device.
- Chooses an item in a ComboBox or ListBox control, either by pressing the arrow keys or by clicking a button on a mouse device.
- Presses the SPACEBAR when a CommandButton, OptionButton, or CheckBox control has the focus.
- Presses ENTER when a form has a CommandButton control with its Default property set to True.
- Presses ESC when a form has a Cancel button—a CommandButton control with its Cancel property set to True.
- Presses an access key for a control. For example, if the caption of a CommandButton control is &Go, pressing ALT+G initiates the event.
You also can initiate the Click event in code by performing the following actions:
- Set the Value property of a CommandButton control to True.
- Set the Value property of an OptionButton control to True.
- Change the Value property setting of a CheckBox control.
- Choose a menu item.