PDA

Click to See Complete Forum and Search --> : Toolbar - 'key' selection *[RESOLVED]*


RealNickyDude
Nov 22nd, 2002, 10:07 AM
How can I capture which button is pressed on a toolbar, besides using (the bold bit): Select Case ToolBar1.Buttons.IndexOf(e.Button)

Case 0
.....

I want to get the name of the button ("save", "load", "new", etc) in case I add / insert buttons later, otherwise i'd have to change all the case statements!

VB 6 had a unique key, but I can't seem to find that on VB .NET?

Edneeis
Nov 22nd, 2002, 10:31 AM
You can use the tag property.

RealNickyDude
Nov 22nd, 2002, 05:19 PM
How exactly?

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Select Case ToolBar1.Buttons.?????


End Select

Edneeis
Nov 22nd, 2002, 05:35 PM
If you have something set as the button tag then you can do this:


Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Select Case e.Button.Tag


End Select

RealNickyDude
Nov 23rd, 2002, 05:45 AM
Thanks Edneeis :D

(I really should get myself more books!)

;)