Toolbar button

  • Thread starter Thread starter Mark Goldin
  • Start date Start date
M

Mark Goldin

I have a toolbar on my form.
How do I know what button was clicked?
 
In your ToolBar's ButtonClick event add code like this:

private void buttonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
switch(toolBar.Buttons.IndexOf(e.Button))
{
case 0:
SomeCodeToRunForButton0();
break;
case 1 :
SomeCodeToRunForButton1();
break;
case 4 :
SomeCodeToRunForButton4();
break;
}
}

Dale
 
What Web toolbar? I'm not aware of one that comes as a part of the .Net
Framework. Can you give more information on what you're using?

Dale
 
Microsoft.Web.UI.WebControls.Toolbar

DalePres said:
What Web toolbar? I'm not aware of one that comes as a part of the .Net
Framework. Can you give more information on what you're using?

Dale
 
Is there some reference you had to set or add to your project to see that?
I don't have it in my toolbox, in my intellisense, and I don't find it in
the framework documentation.

What version of framework are you using?

Dale
 
Ok.. I got it.....Microsoft namespace, rather than System.

So now today has become a good day. I learned something new.

Dale
 
I am having that error:
The type or namespace name 'ToolbarButton' could not be found (are you
missing a using directive or an assembly reference?)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top