How to set a text box for inputing password in winforms?

后端 未结 8 1213
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 13:27

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

8条回答
  •  情书的邮戳
    2020-12-01 13:59

    private void cbShowHide_CheckedChanged(object sender, EventArgs e)
    {
        if (cbShowHide.Checked)
        {
            txtPin.UseSystemPasswordChar = PasswordPropertyTextAttribute.No.Password;
        }
        else
        {
            //Hides Textbox password
            txtPin.UseSystemPasswordChar = PasswordPropertyTextAttribute.Yes.Password;
        }
    }
    

    Copy this code to show and hide your textbox using a checkbox

提交回复
热议问题