how to set a text box for inputing password in winforms? Also I want to show "Capslock is ON" popup if capslock is on.
I want something like
<input type="password" />
in HTML.
how to set a text box for inputing password in winforms? Also I want to show "Capslock is ON" popup if capslock is on.
I want something like
<input type="password" />
in HTML.
The best way to solve your problem is to set the
UseSystemPasswordChar
property to true. Then, the Caps-lock message is shown when the user enters the field and the Caps-Lock is on (at least for Vista and Windows 7).Another alternative is to set the
PasswordChar
property to a character value (* for example). This also triggers the automatic Caps-Lock handling.Copy this code to show and hide your textbox using a checkbox
To set a text box for password input:
you can also change this property in design time by editing properties of the text box.
To show if "Capslock is ON":
Just set the property of textbox that is PasswordChar and set the
*
as a property of textbox. That will work for password.where
passwordtextbox
is the text box name.I know the perfect answer:
I prefer going to windows character map and find a perfect hide like ●.
Just set the TextBox.PasswordChar property to '*'.