I am developping in C#. I need to capture a password written inside a Text Box, but would like to not show the password that is being typed, showing instead **** or any other character to hide the password.
How can I do that? I'm sure it's by modifying an attribute, but can't find which one.
http://msdn.microsoft.com/en-us/library/d3223ht2.aspx
set the PasswordChar property of the textbox
设置PasswordChar
属性 。
在TextBox类上有一个名为“ UseSystemPasswordChar”的属性(假定使用winforms),您可以执行此操作。
To use your own custom character: http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.passwordchar.aspx
To use the system default character: http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.usesystempasswordchar.aspx
textBox1.UseSystemPasswordChar = true;
//or
textBox1.PasswordChar = '%';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.