Displaying ampersand in form label - C#

Viewed 2408

If I build a simple string like this:

string myStr = "Kayla & William";

And then simply set the label text on a form like this:

lbl_Phrase.Text = myStr;

The output in the form removes the ampersand (&)

enter image description here


I've tried:

  • escaping the &
  • ASCII encoding
  • char.ConvertFromUtf32(38)

When I debug and step through the code the string includes the & just fine. Also, I can write the string to Debug.WriteLine(myStr); and it looks great.

Is the problem related to how the form displays the string? How can I get the label to display the &?

1 Answers
Related