ComponentOne Menus and Toolbars for WinForms: Menus and Toolbars for WinForms Task-Based Help > Context Menu Tasks > Retrieving the Name of the C1ContextMenu Control Attached to the C1TextBox

Retrieving the Name of the C1ContextMenu Control Attached to the C1TextBox

Use the GetC1ContextMenu method of C1CommandHolder class to determine which C1ContextMenu is attached to a control. The GetC1ContextMenu method returns the name of the context menu attached to a specific control. You can pass the control name as an argument to this method.

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

      Visual Basic

'retrieves the contextmenu attached to the C1TextBox control

Dim contextMenu As C1.Win.C1Command.C1ContextMenu

contextMenu = C1CommandHolder1.GetC1ContextMenu(C1TextBox1)

MessageBox.Show(ContextMenu.Name)

      C#

//retrieves the contextmenu attached to the C1TextBox control

C1.Win.C1Command.C1ContextMenu contextMenu;

contextMenu = C1CommandHolder1.GetC1ContextMenu(C1TextBox1);

MessageBox.Show(ContextMenu.Name);


Send comments about this topic to ComponentOne.
Copyright © 1987-2008 ComponentOne LLC. All rights reserved.