473,387 Members | 1,435 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Toolbar button

I have a toolbar on my form.
How do I know what button was clicked?
Nov 18 '05 #1
8 1266
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
"Mark Goldin" <ma********@comcast.net> wrote in message
news:O2*************@tk2msftngp13.phx.gbl...
I have a toolbar on my form.
How do I know what button was clicked?

Nov 18 '05 #2
And of course, you are talking about web toolbar?

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:#I**************@TK2MSFTNGP11.phx.gbl...
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
"Mark Goldin" <ma********@comcast.net> wrote in message
news:O2*************@tk2msftngp13.phx.gbl...
I have a toolbar on my form.
How do I know what button was clicked?


Nov 18 '05 #3
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

"Mark Goldin" <ma********@comcast.net> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...
And of course, you are talking about web toolbar?

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:#I**************@TK2MSFTNGP11.phx.gbl...
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
"Mark Goldin" <ma********@comcast.net> wrote in message
news:O2*************@tk2msftngp13.phx.gbl...
I have a toolbar on my form.
How do I know what button was clicked?



Nov 18 '05 #4
Microsoft.Web.UI.WebControls.Toolbar

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
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

"Mark Goldin" <ma********@comcast.net> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...
And of course, you are talking about web toolbar?

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:#I**************@TK2MSFTNGP11.phx.gbl...
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
"Mark Goldin" <ma********@comcast.net> wrote in message
news:O2*************@tk2msftngp13.phx.gbl...
> I have a toolbar on my form.
> How do I know what button was clicked?
>
>



Nov 18 '05 #5
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

"Mark Goldin" <ma********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Microsoft.Web.UI.WebControls.Toolbar

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
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

"Mark Goldin" <ma********@comcast.net> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...
And of course, you are talking about web toolbar?

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:#I**************@TK2MSFTNGP11.phx.gbl...
> 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
>
>
> "Mark Goldin" <ma********@comcast.net> wrote in message
> news:O2*************@tk2msftngp13.phx.gbl...
> > I have a toolbar on my form.
> > How do I know what button was clicked?
> >
> >
>
>



Nov 18 '05 #6
Ok.. I got it.....Microsoft namespace, rather than System.

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

Dale

"Mark Goldin" <ma********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Microsoft.Web.UI.WebControls.Toolbar

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
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

"Mark Goldin" <ma********@comcast.net> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...
And of course, you are talking about web toolbar?

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:#I**************@TK2MSFTNGP11.phx.gbl...
> 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
>
>
> "Mark Goldin" <ma********@comcast.net> wrote in message
> news:O2*************@tk2msftngp13.phx.gbl...
> > I have a toolbar on my form.
> > How do I know what button was clicked?
> >
> >
>
>



Nov 18 '05 #7
And now that I got it... it only took a few seconds of researching to learn
more about the control before I came across this page that shows how to
determine the button that was pushed:

http://msdn.microsoft.com/msdnmag/is...gures.asp#fig1.

That link shows figures from a more indepth article at:

http://msdn.microsoft.com/msdnmag/is.../09/ASPColumn/

Hope that helps, and thanks for the lesson!

Dale

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
Ok.. I got it.....Microsoft namespace, rather than System.

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

Dale

"Mark Goldin" <ma********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Microsoft.Web.UI.WebControls.Toolbar

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
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

"Mark Goldin" <ma********@comcast.net> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...
> And of course, you are talking about web toolbar?
>
> "DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
> news:#I**************@TK2MSFTNGP11.phx.gbl...
> > 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
> >
> >
> > "Mark Goldin" <ma********@comcast.net> wrote in message
> > news:O2*************@tk2msftngp13.phx.gbl...
> > > I have a toolbar on my form.
> > > How do I know what button was clicked?
> > >
> > >
> >
> >
>
>



Nov 18 '05 #8
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?)

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:OI**************@tk2msftngp13.phx.gbl...
And now that I got it... it only took a few seconds of researching to learn more about the control before I came across this page that shows how to
determine the button that was pushed:

http://msdn.microsoft.com/msdnmag/is...gures.asp#fig1.

That link shows figures from a more indepth article at:

http://msdn.microsoft.com/msdnmag/is.../09/ASPColumn/

Hope that helps, and thanks for the lesson!

Dale

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
Ok.. I got it.....Microsoft namespace, rather than System.

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

Dale

"Mark Goldin" <ma********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Microsoft.Web.UI.WebControls.Toolbar

"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
> 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
>
>
>
> "Mark Goldin" <ma********@comcast.net> wrote in message
> news:Ok**************@TK2MSFTNGP11.phx.gbl...
> > And of course, you are talking about web toolbar?
> >
> > "DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message > > news:#I**************@TK2MSFTNGP11.phx.gbl...
> > > 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
> > >
> > >
> > > "Mark Goldin" <ma********@comcast.net> wrote in message
> > > news:O2*************@tk2msftngp13.phx.gbl...
> > > > I have a toolbar on my form.
> > > > How do I know what button was clicked?
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: PK | last post by:
Hello, I am looking for help on the following. I'm trying to create a custom browser toolbar button that will do a few things. One that I'm trying to do at the moment is just simply return the...
0
by: Lauren Quantrell | last post by:
I use the following code to create text edit fields and command buttons in my toolbars: Function CreateToolbarObject(myObjectType as integer) Dim newObject Select Case myObjectType Case 1...
0
by: Tamir Khason | last post by:
Strange problem here (of maybe out-of-behaviour). so this going like this: I have a toolbar, just regalar toolbar and I have buttons (some with text and icon, some with text only and some with icon...
5
by: Stewart | last post by:
Pressing a Save Button on a Toolbar will not bind or validate the last value entered in a text box. I have found that when clicking on the Toolbar the focus in the binded text box does not leave. ...
6
by: Juan Pedro Gonzalez | last post by:
I wanted to add a Combobox to a toolbar... Kind of the look you get on VisualStudio's toolbar. I've been able to find some VB 6 samples, but the placeholder option is no longer available for...
6
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
0
by: CrimeMaster | last post by:
Hi My IE toolbar is based on the Microsoft sample KKBar. I have draw a lot of buttons on it in which some are simply pushDown buttons and some are dropdowns.Beside this I have Made a Setting...
4
by: Gerhard | last post by:
I have an MS Access app with multiple forms. One of the forms has a Toolbar (MsComctlLib.Toolbar) and it works as advertised. I handle the buttons in the Toolbar1_ButtonClick event. I would like...
6
by: =?Utf-8?B?L2Rldi9udWxs?= | last post by:
Hello, i am using visual studio 2003 enterprise architect version. I am making apps for the .Net framework 1.1. While testing an interface, i discovered something strange. In this application...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.