Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show an "&" (ampersand) in button or label text?

I would like to show the & character, not the keyboard shortcut in the text property of a button or label.

Is there a way to do this?

like image 709
atrueresistance Avatar asked Sep 29 '11 18:09

atrueresistance


People also ask

What are the five ways to show love?

We all give and receive love in 5 different ways: words of affirmation, acts of service, receiving gifts, quality time, and physical touch. These are called 'love languages' - a concept created by Dr. Gary Chapman through his long-time work as a marriage counsellor.


2 Answers

If you are trying to display & in button text, use &&. A single & is used for keyboard shortcuts, and a double ampersand will escape that.

The article Escape ampersand (&) character in C# mentions that you can leave the caption unaltered with single & and just set UseMnemonic property of the button to false.

like image 137
Bala R Avatar answered Oct 18 '22 03:10

Bala R


Try double & (&&). It works with VBA code.

like image 6
Rashmi Avatar answered Oct 18 '22 02:10

Rashmi