.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

Toolbar question

Besides querying the Text property, how do you find out which button on the toolbar has been clicked? The Name property doesn't appear in the code window, but only appears in the design mode.

The problem is that I have added a lot of spaces to the left of the label of one of my buttons. The actual label text I have entered in the design mode is "    Exit Map".

When I query this:

else if (e.Button.Text.Trim() == "Exit Map")
            {
                this.Dispose();
                this.Close();
            }

The code skips this condition altogether. For the other labels, it enters the construct as it should. I am a bit confused.
raapchik raapchik jumbo Send private email
Tuesday, July 18, 2006
 
 
I had to resolve the same problem, finding out, which button was clicked. I used the ImageIndex for identification. Not very elegant either, I guess, but it will save you trouble if you ever have to make a version of your software in another language and the GUI strings change.

I don't know why your condition does not work. Maybe you have a hidden character which does not count as whitespace? Carriage return oder the like?
Jutta Jordans Send private email
Tuesday, July 18, 2006
 
 
My bad! I had an extra space in between the two words.
raapchik raapchik jumbo Send private email
Tuesday, July 18, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz