Toolbars

  • Thread starter Thread starter Sprocket
  • Start date Start date
S

Sprocket

How can I access the individual click events for each
button on a toolbar with a view to executing code ?

thanks
 
Hi Sprocket I had to do this not so long ago and came up
with this solution:

\\\
Private Sub ToolBar1_ButtonClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) _
Handles ToolBar1.ButtonClick

Select Case ToolBar1.Buttons.IndexOf(e.Button)
Case 0
MessageBox.Show("1st button clicked")
Case 1
MessageBox.Show("2nd button clicked")
Case 2
MessageBox.Show("3rd button clicked")
End Select

End Sub
///

but bare in mind I'm a rank amateur so to be honest I
don't know how solid this code actually is but it met my
needs well, you'll probably get better / alternative
way's of doing this from the experts but this should give
you something to work with for the time being

Regards Steve
 
* "Sprocket said:
How can I access the individual click events for each
button on a toolbar with a view to executing code ?

\\\
Private Sub ToolBar1_ButtonClick( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs _
) Handles ToolBar1.ButtonClick
Select Case True
Case e.Button Is Me.ToolBarButton1
 
Back
Top