ComponentOne Menus and Toolbars for WinForms
Retrieving the ContextMenu Control Attached to the TextBox
Menus and Toolbars for WinForms Task-Based Help > Context Menu Tasks > Retrieving the ContextMenu Control Attached to the TextBox

Use the GetC1ContextMenu method of C1CommandHolder class to determine which C1ContextMenu is attached to a control. The GetC1ContextMenu method returns the context menu attached to a specific control.

To retrieve the name of the C1ContextMenu control attached to the C1TextBox1, use the following code:

To write code in Visual Basic

Visual Basic
Copy Code
'retrieves the contextmenu attached to the C1TextBox control
Dim contextMenu As C1.Win.C1Command.C1ContextMenu
contextMenu = C1CommandHolder1.GetC1ContextMenu(C1TextBox1)
MessageBox.Show(ContextMenu.Name)

To write code in C#

C#
Copy Code
//retrieves the contextmenu attached to the C1TextBox control
C1.Win.C1Command.C1ContextMenu contextMenu;
contextMenu = C1CommandHolder1.GetC1ContextMenu(C1TextBox1);
MessageBox.Show(ContextMenu.Name);
See Also