But I can now say "Wow, no wonder she's a MVP." Your's is the only example I've seen where an enum is used instead of just the index. So your code is much more readable.
Can I have your autograph next time we meet? You know, before you get too famous.
>Perry,
>
>You should have started another thread. <g>
>
>Anyway, I simply use one ButtonClick EventHandler for every button in the ToolBar. I also use an Enum for all the buttons. So, something like this:
>
>private void MyToolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
>{
> int button = this.ToolBar.Buttons.IndexOf(e.Button);
>
> switch (button)
> {
> case (int)Buttons.DoThis :
> // code here
> break;
>
> case (int)Buttons.DoThat:
> // code here
> break;
>
> case (int)Buttons.DoTheOther:
> // code here
> break;
>
> default :
> // code here
> break;
> }
>}
>
>
>~~Bonnie
>
>
>
>>Here's a simple one to start you off. What are the options in C# for adding code for clicking on toolbar buttons. And what's the prefered method?
>>
>>>Hope y'all don't mind if I don't reply to each individual post. Too much bandwidth. <g>
>>>
>>>Thanks for all your good wishes!!!
>>>
>>>Let's see ... I already thanked Kevin, Fred and Einar. Now it's time to thank Cetin, John, Perry, Denis and Victor.
>>>
>>>John said:
>>>
>>>
>>Congrats. You deserve it for putting up with Kevin Goff, LOL<<>>>
>>>Ain't that the truth!!!! <g>
>>>
>>>Perry said:
>>>
>>>
>>Congrats. Almost time to make you work for your money. I would expect the questions to start rolling in from me in a couple weeks.<<>>>
>>>I'm ready and waiting!
>>>
>>>Victor said:
>>>
>>>
>>Speech!! Speech!!<<>>>
>>>Speeches?!? We don't need no steenking speeches!!! <g>
>>>
>>>Thanks again everyone.
>>>
>>>~~Bonnie
(On an infant's shirt): Already smarter than Bush