Password in Text Box
Posted on 2011-10-26
I'm experimenting with a TextBox which I want to input a password. I have set a checkbox below the TextBox which is labelled "Show Password". The code of the checkbox is shown below
Private Sub m_cbShowPassword_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m_cbShowPassword.CheckedChanged
Me.tbPassword.UseSystemPasswordChar = Not Me.m_cbShowPassword.Checked
As you can see, I cam attempting to show the password or hide it e.g. *********, depending on whether the checkbox is checked or not.
This works fine until I specify a character in the PasswordChar of the TextBox e.g. * or &. If I do this then password is always hidden (either by * or & - in this case).
I'm guessing that using PasswordChar will always hide the password. Is there a way to specify the character used for the password if UseSystemPasswordChar is used?