# Creating a Separate Click Event for a Command Object

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

## Content



To assign an address of a method to the **Click** event of [C1Command](/componentone/docs/win/online-menus-toolbar/), with the same signature as the **ClickEventHandler** delegate, use the **AddHandler** method. To do this, use the following code:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
Dim ch As C1CommandHolder = C1CommandHolder.CreateCommandHolder(Me)
'create commands for file ops.
Dim cNew as C1Command = ch.CreateCommand()
'Use the AddHandler method to assign a delegate for the click event.
AddHandler cNew.Click, New ClickEventHandler(AddressOf cNew_Click)
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this);
//create commands for file ops.
C1Command cNew = ch.CreateCommand();
//Use the AddHandler method to assign a delegate for the click event.
cNew.Click += new C1.Win.C1Command.ClickEventHandler(cNew Click);
```

DOC-DETAILS-TAG-CLOSE

## See Also

[Creating a Window List for an MDI Form](/componentone/docs/win/online-menus-toolbar/menusandtoolbarsforw2/menutasks/creatingawindowlistf)