Visual Basic Reference

Visual Studio 6.0

DblClick Event

See Also    Example    Applies To

Occurs when the user presses and releases a mouse button and then presses and releases it again over an object.

For a form, the DblClick event occurs when the user double-clicks a disabled control or a blank area of a form. For a control, it occurs when the user:

  • Double-clicks a control with the left mouse button.

  • Double-clicks an item in a ComboBox control whose Style property is set to 1 (Simple) or in a FileListBox, ListBox, DataCombo, or DataList control.


Private Sub Form_DblClick ( )

Private Sub object_DblClick (index As Integer)

Part Description
object An object expression that evaluates to an object in the Applies To list.
index Identifies the control if it's in a control array.


The argument Index uniquely identifies a control if it's in a control array. You can use a DblClick event procedure for an implied action, such as double-clicking an icon to open a window or document. You can also use this type of procedure to carry out multiple steps with a single action, such as double-clicking to select an item in a list box and to close the dialog box.

To produce such shortcut effects in Visual Basic, you can use a DblClick event procedure for a list box or file list box in tandem with a default button a CommandButton control with its Default property set to True. As part of the DblClick event procedure for the list box, you simply call the default button's Click event.

For those objects that receive Mouse events, the events occur in this order: MouseDown, MouseUp, Click, DblClick, and MouseUp.

If DblClick doesn't occur within the system's double-click time limit, the object recognizes another Click event. The double-click time limit may vary because the user can set the double-click speed in the Control Panel. When you're attaching procedures for these related events, be sure that their actions don't conflict. Controls that don't receive DblClick events may receive two clicks instead of a DblClick.

When debugging events, do not use MsgBox statements to show when the event occurred, as this will disturb the normal functioning of many events. (For example, a MsgBox in the Click event will prevent DblClick from being raised.) Instead, use Debug.Print to show the order in which events occur

Note   To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.