Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
Label control "&" question
posted

If I set the text property of a label control to a string that contains an ampersand, when the control is drawn onscreen (in Windows XP) I get an underline instead of the ampersand (in Vista it looks like it just omits the ampersand and no underline appears).  How can I avoid this?  Is there a property I can set that will just display ampersands or do I actually have to replace "&" with "&&"?

  • 37774
    posted

    There is a UseMnemonic property that you can set to False to prevent this behavior.  As to why it isn't showing up in Vista, this is likely due to the OS setting of whether to hide mnemonics until the Alt key is pressed.

    -Matt