ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars for WinForms Task-Based Help / Menu Tasks / Creating a Separate Click Event for a Command Object
In This Topic
    Creating a Separate Click Event for a Command Object
    In This Topic

    To assign an address of a method to the Click event of C1Command, with the same signature as the ClickEventHandler delegate, use the AddHandler method. To do this, use the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    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)
    

    To write code in C#

    C#
    Copy Code
    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);
    
    See Also