How can I unmask password text box and mask it back to password?

前端 未结 7 1069
情深已故
情深已故 2020-11-27 21:36

How can password textbox that set to :

password_txtBox.PasswordChar =\"*\"

to be unmasked ( from checkbox ) and then mask again
without

7条回答
  •  甜味超标
    2020-11-27 22:00

    If you are working with toggle switch then

    private void toggleSwitch1_Toggled(object sender, EventArgs e)
    {
        if (toggleSwitch1.IsOn)
        {
            string a= textBox2.Text;
            textBox2.PasswordChar = '\0';
        }
        else
        {
            textBox2.PasswordChar = '*';
        }
    }
    

    here '\0' will show to password filed to plain text

提交回复
热议问题