|
-
Nov 22nd, 2007, 08:44 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2008] ToolStripStatusBar Text cannot have special characters?
Hi All,
What stumped me was: when I tried putting
ToolStripStatusLabel1.Text = "Drag & Drop Files or press Browse".
The text appeared as "Drag _Drop Files or press Browse".
Obviously the & sign was missing.
Is this a limitation or am I missing some setting/
Thanks,
Mcore
-
Nov 22nd, 2007, 05:35 PM
#2
Re: [2008] ToolStripStatusBar Text cannot have special characters?
The ampersand is used to create mnemonics, e.g. you set the Text of a menu item to "&File" and the 'F' will then be underlined to indicate that that is the access key for the menu item. Pressing Alt+F will then invoke that menu item's Click event. What you've done is create a label whose access key is the space bar. If you want a literal ampersand in controls that support mnemonics then you need to escape the character with another ampersand:
vb.net Code:
ToolStripStatusLabel1.Text = "Drag && Drop Files or press Browse"
-
Nov 28th, 2007, 01:44 AM
#3
Thread Starter
Addicted Member
Re: [2008] ToolStripStatusBar Text cannot have special characters?
Thanks jmcilhinney, that explains the mystery. The status bar also displays the current file path which will be processed. So this means I will have to parse the file path string through a text replacement function to replace any & to &&.
It kind of doesn’t make sense to have such thing in the status bar. It makes sense for a menu so when you press ALT you see what letter you want to press in order to access the menu.
Cheers,
McoreD
-
Nov 28th, 2007, 01:50 AM
#4
Re: [RESOLVED] [2008] ToolStripStatusBar Text cannot have special characters?
ToolStripStatusLabel derives from ToolStripLabel. Just like a regular Label, whose access key would select the next control in the Tab order, so too does the ToolStripLabel. The ToolStripStatusLabel just happens to inherit that behaviour. It's conceivable that it might be useful but very rarely, I agree. Just a side-effect you have to live with, unfortunately.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|