JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Handling Toolbar Button Clicks

When a button in a toolbar is clicked, the toolbar's ButtonClick event happens. (There are no such events for the individual buttons in the toolbar.) You can see which button was clicked by taking a look at the Button property of the ToolBarButtonClickEventArgs object passed to the ButtonClick event handler. Here's how that works in the ToolBars example on the CD-ROM, where I'm reporting the text of the clicked button in a message box:

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) _
    Handles ToolBar1.ButtonClick
    MsgBox("You clicked the " & e.Button.Text)
End Sub

Here's how you can check whether a particular button was clicked:

If e.Button Is ToolBar1.Buttons(1) Then
               
End If
Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor