jimday1982 Posted August 5, 2003 Posted August 5, 2003 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 Quote
Hughng Posted August 5, 2003 Posted August 5, 2003 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 Quote
bfellwock Posted August 5, 2003 Posted August 5, 2003 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 :) Quote
jimday1982 Posted August 5, 2003 Author Posted August 5, 2003 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! Quote
Diablicolic Posted August 5, 2003 Posted August 5, 2003 Wait wait I don't understand, what are you guys doing to the tool bar? aaahhh I'm so confused, buttons on the toolbar?? wwwhhhaatt?? :confused: Quote "Reality is fake, Dreams are for real"
*Experts* mutant Posted August 5, 2003 *Experts* Posted August 5, 2003 There is a toolbar windows forms control. Are you maybe thinking about some other toolbar? :) Quote
Diablicolic Posted August 5, 2003 Posted August 5, 2003 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? Quote "Reality is fake, Dreams are for real"
*Experts* mutant Posted August 5, 2003 *Experts* Posted August 5, 2003 :) 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 :). Quote
jorge Posted August 6, 2003 Posted August 6, 2003 Some more exaple, Internet explorer, outlouk exprless, office 97-2003 beta, Visualstudio, ... Quote Jorge - http://www.blackdot.be/?page=apache.htm
Diablicolic Posted August 6, 2003 Posted August 6, 2003 Is there a way to make toolbars to run vertical rather than horizontal? Quote "Reality is fake, Dreams are for real"
Winston Posted August 6, 2003 Posted August 6, 2003 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. Quote
bfellwock Posted August 6, 2003 Posted August 6, 2003 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. Quote
Diablicolic Posted August 7, 2003 Posted August 7, 2003 So tttthhhhaaattt's what the dock property does lol. Thank you. Quote "Reality is fake, Dreams are for real"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.