Ticket B93797
Visible to All Users

LabelControl.Text: Does Not Display '&' If String Contains This Character

created 17 years ago

Hello, Support:
I've encountered a bug similar to one I reported before in layout captions (which you fixed). If I set a LabelControl's Text property to a string that contains '&' (ampersand), the ampersand does not display…only a space.
Steps to Reproduce:
Set the Text property of an instance of LabelControl to, say, "C & H Pure Cane Sugar", and you will see that the ampersand does not display.
Actual Results:
"C & H Pure Cane Sugar" displays as "C H Pure Cane Sugar".
Expected Results:
Should display as "C & H Pure Can Sugar".

Answers approved by DevExpress Support

created 17 years ago (modified 8 years ago)

Hello Eric,

Our LabelControl works in the same way as a standard WIndows.Forms.Label control (please see the attached sample).  A character followed by the & sign within a caption is used as a mnemonic char. If you need to show the ampersand symbol, you use the "&&" string or disable the LabelControl.UseMnemonic option.
Please try this solution and inform us of your results.

    Comments (2)

      If you dont need the functionality you can also just turn UseMnemonic to False

      Visual Basic
      label.UseMnemonic = False
      DevExpress Support Team 8 years ago

        Yes, that's correct. Thank you for posting this solution here!
        I've updated our answer accordingly.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.