# Retrieving the ContextMenu Control Attached to the TextBox

Get started with Menus and Toolbars for WinForms. Create versatile menus and docking/floating toolbars. See more in documentation here.

## Content



Use the [GetC1ContextMenu](/componentone/docs/win/online-menus-toolbar/) method of [C1CommandHolder](/componentone/docs/win/online-menus-toolbar/) class to determine which [C1ContextMenu](/componentone/docs/win/online-menus-toolbar/) is attached to a control. The [GetC1ContextMenu](/componentone/docs/win/online-menus-toolbar/) 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:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

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

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
//retrieves the contextmenu attached to the C1TextBox control
C1.Win.C1Command.C1ContextMenu contextMenu;
contextMenu = C1CommandHolder1.GetC1ContextMenu(C1TextBox1);
MessageBox.Show(ContextMenu.Name);
```

DOC-DETAILS-TAG-CLOSE

## See Also

[Linking the Context Menu to a NotifyIcon Control](/componentone/docs/win/online-menus-toolbar/menusandtoolbarsforw2/contextmenutasks/linkingthec1contextm)