Consider:
Label label = new Label();
label.Text = "&";
But... I can't see the &, after I run the program.

How do I show that character in a label?
I want to show only the character. &
That's because & in labels, buttons and menus is prefixed to access key characters, i.e. those characters you can press with Alt to give focus to a control directly.
label1.UseMnemonic = false;
will get rid of that behaviour.
From the documentation of UseMnemonic:
true if the label doesn't display the ampersand character and underlines the character after the ampersand in its displayed text and treats the underlined character as an access key; otherwise, false if the ampersand character is displayed in the text of the control. The default is true.
If you need to display & and the access key behaviour, then you need to escape the & as &&, as several other answers mentioned.
Use this:
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "&&";
}
& is used as a Localizable resource in Windows Forms. And it is also used to specify shortcuts. So you need to escape it:
this.label1.Text = "&&";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With