c# - Enter "&" symbol into a text Label in Windows Forms? -


how 1 enter special characters label in c# (windows forms)?

if try write "&" label you'll sort of underscore instead..

so what's c# equivalent of "&"? ("\&" doesn't work).

two ways:

  • escape ampersand (&&).

  • set usemnemonic label false. causes ampersands within text taken literally don't need double of them. you'll lose underlining , access key features though.

    you can set value either in designer, or in code:

    mylabel.usemnemonic = false; mylabel.text = "text&text"; 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -