Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have a toolbar with buttons but when I doubleclick one of the buttons to put code behind them, I am only able to put code behind the WHOLE toolbar and not the individual buttons. What's the secret to putting code behind each button on the toolbar? Thanks
Posted

You need to compare the text of your button and run the right button.

 

Exp:

 

==========================================

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

Try

 

Select Case e.Button().Text().ToUpper()

Case "EXIT"

' Do something here (exit)

Case "LOAD"

' Load something here (application ..)

Case "RUN"

' Run something here (Application)

Case Else

MsgBox("Unimplement button, try later")

End Select

Catch Exp As Exception

MsgBox("Exception: " & Exp.Message, MsgBoxStyle.Critical)

End Try

End Sub

=======================================

 

Hope that help

Posted

Select Case toolBar1.Buttons.IndexOf(e.Button)
       Case 0
           Insert your code for button 0
       Case 1
           Insert your code for button 1
       Case 2
           Insert your code for button 2
   End Select

:)

Posted
Select Case toolBar1.Buttons.IndexOf(e.Button)
       Case 0
           Insert your code for button 0
       Case 1
           Insert your code for button 1
       Case 2
           Insert your code for button 2
   End Select

:)

 

Awesome. Works like a charm. Thanks!

Posted

http://www.angelfire.com/droid/lolclan/images/toolbar.JPG

 

I found it! hehehe :p

 

But, are toolbars that common, and are they used for a lot of things?

"Reality is fake, Dreams are for real"
  • *Experts*
Posted

:)

Yeah, they are used very commonly. For example open WordPad, you see the buttons down below the menu? That is a toolbar, same goes for VS.NET, except they have a custom toolbar that looks so much better than the standard one :).

Posted

they would have to be custom made toolbars which are dockable

standard conventional toolbars provided by .NET itself doesn't support this let alone does it support chevron and grippers.

Posted
Yes Diablicolic, you can make the toolbar vertical. Check out the dock property of the toolbar. You can set the dock property to NONE and put the toolbar wherever you want.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...