Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toolbar Buttons not working

Status
Not open for further replies.

dexthageek

IS-IT--Management
Mar 23, 2002
59
US
Hello,

Im just again getting into VB havent worked with it in over 5yrs and I am rusty. Im having a hard time getting my Toolbar Buttons to work. I created my toolbar, imagelist, and buttons.

They are for a browser for an elementary school.

I have Back (cmdBack) Forward (cmdForward) etc...

Whenever I try to call cmdBack.Click is fails giving me an error. "Click" event not found.

What am I doing wrong?

Please im going crazy here.

Thanks in advance
Mike
 
Just to make sure:

1. This progect is in vb.net ?
2. You want to do some action after clicking a toolbar button, not a simple button ?


??
 
I have a Toolbar at the top of my application. On the toolbar are 4 buttons.

I named the buttons:

cmdBack, cmdForward, etc...

For some reason it will not let me set a ClickEvent for each button but only 'toolbar1.click'. Now the code located in that sub routine is excuted no matter what button I press.

I must be doing something wrong, If someone could possible point me in the correct direction for creating a toolbar that might even by my problem.

I will post my code tomorrow when I get back into work.

Thanks in Advance
Mike
 
You're not doing anything wrong. This is the exact behaviour of the toolbar

The easiest way around this is utilise the Tag property of each button, say put 1 in the first button, 2 in the second etc..

Then in the toolbar buttonclick event, get the button pressed by looking at the value of e.button.tag


Sweep
...if it works dont mess with it
 
Solution is given. Use plus a select case at e.button.tag and will work fine.
 
Thanks, that I used "Select Case" and it worked great.

- Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top