Click to See Complete Forum and Search --> : *resolved* what's the right way to check for toolbar buttons when clicked
MrPolite
Jul 6th, 2002, 03:36 PM
right now I'm checking the tag property :D, what would be a good way to find out what button is clicked. I dont want to use if e.button = myToolBarButton because I'm using a select case statement and it doesnt let me to use e.button for my case....
any ideas?:rolleyes:
hellswraith
Jul 6th, 2002, 06:13 PM
This sample is from the MSDN Library site...
Protected Sub toolBar1_ButtonClick(sender As Object, _
e As ToolBarButtonClickEventArgs)
' Evaluate the Button property to determine which button was clicked.
Select Case toolBar1.Buttons.IndexOf(e.Button)
Case 0
openFileDialog1.ShowDialog()
' Insert code to open the file.
Case 1
saveFileDialog1.ShowDialog()
' Insert code to save the file.
Case 2
printDialog1.ShowDialog()
' Insert code to print the file.
End Select
End Sub
Here is the link:
http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformstoolbarclassbuttonclicktopic.asp
MrPolite
Jul 6th, 2002, 06:52 PM
I might change the buttons every now and then, so I think I'll just save the button name in the tag and then I check for the tag property...
tnx for the help :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.