Results 1 to 5 of 5

Thread: Toolbar - 'key' selection *[RESOLVED]*

  1. #1

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Thumbs up Toolbar - 'key' selection *[RESOLVED]*

    How can I capture which button is pressed on a toolbar, besides using (the bold bit):
    VB Code:
    1. Select Case ToolBar1.Buttons.[b]IndexOf(e.Button)[/b]
    2.  
    3. Case 0
    4.      .....

    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?
    Last edited by RealNickyDude; Nov 25th, 2002 at 05:59 PM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can use the tag property.

  3. #3

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    How exactly?

    VB Code:
    1. Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
    2.         Select Case ToolBar1.Buttons.?????
    3.  
    4.  
    5.         End Select
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If you have something set as the button tag then you can do this:

    VB Code:
    1. Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
    2.         Select Case e.Button.Tag
    3.  
    4.  
    5.         End Select

  5. #5

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Thanks Edneeis

    (I really should get myself more books!)

    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

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