How can I unmask password text box and mask it back to password?
How can password textbox that set to :
password_txtBox.PasswordChar ="*"
to be unmasked ( from checkbox ) and then mask again
without loosing the string inside the textbox
For winforms:
private void checkBoxShowPassword_CheckedChanged(object sender, EventArgs e) {
textBoxPassword.PasswordChar = checkBoxShowPassword.Checked ? '\0' : '*';
}
Just set the property to '\0' (which is the default value) to not mask characters.
Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.passwordchar.aspx
Note: notice that '\0' is different from '0'. The first one is the null character, white '0' is the character that will be displayed as 0.