How do I enter a unicode character (it needs to be the equivalent of ascii character 254, a solid square centered box) as the password character in a textbox?
I need to do this in code, 开发者_运维百科for example textbox.passwordchar = ????????
Thanks,
The same way you enter any other character.
C# source files can contain Unicode characters in identifiers and strings.
You can also use the escape sequence "\uxxxx"
to use a Unicode character by (hex) codepoint.
Use the TestBox.PasswordChar property. Assuming you want UNICODE
character BLACK SQUARE (U+25A0), either do:
yourTextBox.PasswordChar = '■';
Or:
yourTextBox.PasswordChar = '\u25a0';
textBox_Name.PasswordChar='■';
When you want to use any of the unicode char simply Press ALT & then ascii value of that key while pressing ALT key
e.g.
■ = ALT+254
♪ = ALT+269
A = ALT+65
a = ALT+97
NOTE: numeric keys must be pressed from NumPad
tb.PasswordChar = (char)254;
I believe you should be able to just assign a constant Unicode character, as described in this MSDN article...
this.tePassword.Properties.PasswordChar = (char)254; results in a character that looks similar to a b - it's definitely not ascii 254.
精彩评论