davidrichardson
asked on
Toolbar Problem
how to i add events to toolbar buttons, i cant work out how to get the toolbar buttons to work
ASKER
That gives me the same event on all the buttons, how do I specify each button
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hello,
This references the index of each button in the toolbar that you made:
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolB arButtonCl ickEventAr gs) Handles ToolBar1.ButtonClick
Select Case ToolBar1.Buttons.IndexOf(e .Button)
Case 0
'skip this one
Case 1
'code for 1st button
Case 2
'More code here for other buttons
Case 3 'etc etc
End Select
End Sub
Good luck
Chris
This references the index of each button in the toolbar that you made:
Private Sub ToolBar1_ButtonClick(ByVal
Select Case ToolBar1.Buttons.IndexOf(e
Case 0
'skip this one
Case 1
'code for 1st button
Case 2
'More code here for other buttons
Case 3 'etc etc
End Select
End Sub
Good luck
Chris
ASKER
sorry i thought i closed this question
MsgBox(e.Button)
End Sub
This will pop up a message box telling the button text that was clicked.