DblClick Event

Applies To

CheckBox control, ComboBox control, CommandButton control, Frame control, Image control, Label control, ListBox control, MultiPage control, OptionButton control, TabStrip control, TextBox control, ToggleButton control, UserForm object.

Description

Occurs when the user points to an object and then clicks a mouse button twice.

Syntax

For MultiPage, TabStrip

Private Sub object_DblClick( index As Long, ByVal Cancel As MSForms.ReturnBoolean)

For other controls

Private Sub object_DblClick( ByVal Cancel As MSForms.ReturnBoolean)

The DblClick event syntax has these parts:

Part

Description

object

Required. A valid object.

index

Required. The position of a Page or Tab object within a Pages or Tabs collection.

Cancel

Required. Event status. False indicates that the control should handle the event (default). True indicates the application handles the event.


Remarks

For this event to occur, the two clicks must occur within the time span specified by the system's double-click speed setting.

For controls that support Click, the following sequence of events leads to the DblClick event:

  1. MouseDown
  2. MouseUp
  3. Click
  4. DblClick
If a control, such as TextBox, does not support Click, Click is omitted from the order of events leading to the DblClick event.

If the return value of Cancel is True when the user clicks twice, the control ignores the second click. This is useful if the second click reverses the effect of the first, such as double-clicking a toggle button. The Cancel argument allows your form to ignore the second click, so that either clicking or double-clicking the button has the same effect.

See Also

Click event, MouseDown, MouseUp events.

Example

See the CanPaste property example.