Results 1 to 3 of 3

Thread: *resolved* what's the right way to check for toolbar buttons when clicked

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    *resolved* what's the right way to check for toolbar buttons when clicked

    right now I'm checking the tag property , 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?
    Last edited by MrPolite; Jul 6th, 2002 at 06:52 PM.

  2. #2
    hellswraith
    Guest
    This sample is from the MSDN Library site...
    VB Code:
    1. Protected Sub toolBar1_ButtonClick(sender As Object, _
    2.     e As ToolBarButtonClickEventArgs)
    3.    
    4.     ' Evaluate the Button property to determine which button was clicked.
    5.     Select Case toolBar1.Buttons.IndexOf(e.Button)
    6.         Case 0
    7.             openFileDialog1.ShowDialog()
    8.             ' Insert code to open the file.
    9.         Case 1
    10.             saveFileDialog1.ShowDialog()
    11.             ' Insert code to save the file.
    12.         Case 2
    13.             printDialog1.ShowDialog()
    14.             ' Insert code to print the file.
    15.     End Select        
    16. End Sub

    Here is the link:
    http://www.msdn.microsoft.com/librar...clicktopic.asp

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width