I want to set the error message to text box using error provider.
string strNotAllowedError = "The following characters are not allowed: \' # & < > or \"";
errorProvider1.SetError(this.txtbx1, strNotAllowedError);
but the on the screen error message is become like : The following characters are not allowed:'# _ < > or" Here & is replaced by _ Please let me know how to show & in error message as it is.
You need to double up the &
character.
Traditionally, &
in strings (that are going to be displayed in the windows UI) is used to precede the keyboard accelerator character. Which when rendered is underlined. If you'd not had a space after the &
, you'd have seen whatever character followed underlined, rather than seeing it as the &
being replaced by a _
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments