WorksheetBase.BeforeDoubleClick Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the worksheet is double-clicked, before the default double-click action.
public:
event Microsoft::Office::Interop::Excel::DocEvents_BeforeDoubleClickEventHandler ^ BeforeDoubleClick;
public event Microsoft.Office.Interop.Excel.DocEvents_BeforeDoubleClickEventHandler BeforeDoubleClick;
member this.BeforeDoubleClick : Microsoft.Office.Interop.Excel.DocEvents_BeforeDoubleClickEventHandler
Public Custom Event BeforeDoubleClick As DocEvents_BeforeDoubleClickEventHandler
Event Type
Examples
The following code example demonstrates a handler for the BeforeDoubleClick event that cancels the double-click action on the current worksheet. The event handler informs the user that double-clicking is not allowed for the worksheet, and then sets the Cancel
parameter of the DocEvents_BeforeDoubleClickEventHandler event handler to true
so that Microsoft Office Excel cancels the double-click action.
This example is for a document-level customization.
private void WorksheetBeforeDoubleClick()
{
this.BeforeDoubleClick +=
new Excel.DocEvents_BeforeDoubleClickEventHandler(
Worksheet1_BeforeDoubleClick);
}
void Worksheet1_BeforeDoubleClick(Excel.Range Target,
ref bool Cancel)
{
MessageBox.Show("Double-clicking in this sheet" +
" is not allowed.");
Cancel = true;
}
Sub Worksheet1_BeforeDoubleClick(ByVal Target As Excel.Range, _
ByRef Cancel As Boolean) Handles Me.BeforeDoubleClick
MsgBox("Double-clicking in this sheet is not allowed.")
Cancel = True
End Sub
Remarks
This event does not occur when the user double-clicks the border of a cell.