-
I've got an assignment where I want to have a toolbar and menus.
The toolbar and menus will essentially do the same thing so I want to just pass the menu index that has just been selected to the toolbar_ButtonClick method as that will contain all the turning on/off of buttons etc.
The problem is the ButtonClick method takes this parameter:
(ByVal Button As MSComctlLib.Button)
Does anyone know if I will have to create the code twice for the same thing or is there a way to pass it to the method? Maybe creating my own method would be the best way?
Cheers
-
I'm not sure if I know exactly what you mean but I usually do it like this;
Each button on the toolbar has a 'Key' property that you can type in from the properties window.
Then, in the Button_Click event;
Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "new"
mnuNew_Click
Case "open"
mnuOpen_Click
etc..etc.etc..
End Select
End Sub
Hope this helps