ListObject.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 ListObject control is double-clicked, before the default double-click action.
public:
event Microsoft::Office::Interop::Excel::DocEvents_BeforeDoubleClickEventHandler ^ BeforeDoubleClick;
event Microsoft.Office.Interop.Excel.DocEvents_BeforeDoubleClickEventHandler BeforeDoubleClick;
member this.BeforeDoubleClick : Microsoft.Office.Interop.Excel.DocEvents_BeforeDoubleClickEventHandler
Event BeforeDoubleClick As DocEvents_BeforeDoubleClickEventHandler
Event Type
Examples
The following code example creates a ListObject and a BeforeDoubleClick event handler. When the ListObject is double-clicked, a message is displayed that indicates whether the ListObject is bound to data.
This version is for a document-level customization.
Microsoft.Office.Tools.Excel.ListObject list2;
private void ListObject_BeforeDoubleClick()
{
list2 = this.Controls.AddListObject(
this.Range["A1", "C4"], "list2");
list2.BeforeDoubleClick += new
Microsoft.Office.Interop.Excel.
DocEvents_BeforeDoubleClickEventHandler(
list2_BeforeDoubleClick);
}
void list2_BeforeDoubleClick(Microsoft.Office.Interop.Excel.Range
Target, ref bool Cancel)
{
MessageBox.Show("Data binding is " + list2.IsBinding);
}
WithEvents List2 As Microsoft.Office.Tools.Excel.ListObject
Private Sub ListObject_BeforeDoubleClick()
List2 = Me.Controls.AddListObject( _
Me.Range("A1", "C4"), "List2")
End Sub
Sub List2_BeforeDoubleClick(ByVal Target As _
Microsoft.Office.Interop.Excel.Range, ByRef Cancel As Boolean) _
Handles List2.BeforeDoubleClick
MessageBox.Show("Data binding is " & List2.IsBinding)
End Sub
This version is for an application-level add-in.
ListObject list2;
private void ListObject_BeforeDoubleClick()
{
Worksheet vstoWorksheet =
Globals.Factory.GetVstoObject(this.Application.ActiveWorkbook.Worksheets[1]);
list2 = vstoWorksheet.Controls.AddListObject(
vstoWorksheet.Range["A1", "C4"], "list2");
list2.BeforeDoubleClick += new
Excel.DocEvents_BeforeDoubleClickEventHandler(
list2_BeforeDoubleClick);
}
void list2_BeforeDoubleClick(Microsoft.Office.Interop.Excel.Range
Target, ref bool Cancel)
{
System.Windows.Forms.MessageBox.Show("Data binding is " + list2.IsBinding);
}
WithEvents List2 As ListObject
Private Sub ListObject_BeforeDoubleClick()
Dim NativeWorksheet As Microsoft.Office.Interop.Excel.Worksheet =
Me.Application.Worksheets(1)
Dim vstoWorksheet As Microsoft.Office.Tools.Excel.Worksheet =
Globals.Factory.GetVstoObject(NativeWorksheet)
List2 = vstoWorksheet.Controls.AddListObject( _
vstoWorksheet.Range("A1", "C4"), "List2")
End Sub
Sub List2_BeforeDoubleClick(ByVal Target As _
Microsoft.Office.Interop.Excel.Range, ByRef Cancel As Boolean) _
Handles List2.BeforeDoubleClick
System.Windows.Forms.MessageBox.Show("Data binding is " & List2.IsBinding)
End Sub