当前位置:网站首页>C # realizes the login interface, and the password asterisk is displayed (hide the input password)

C # realizes the login interface, and the password asterisk is displayed (hide the input password)

2022-07-03 14:49:00 Jack1009HF

C# Realize the login interface , Password asterisk display ( Hide the input password )

 Insert picture description here
In software design , It is often necessary to set the login permission of users . When the user fills in the password , How to realize input hiding , Or with “*” No. for hidden display ? We need to use textBox Of PasswordChar attribute .

Attribute interpretation

PasswordChar Property is used to get or set characters , This character is used to mask a single line TextBox Password characters in control .

Code

The following shows checkBox State switching response function Code

private void ckBoxPassword_CheckedChanged(object sender, EventArgs e)
{
    if(ckBoxPassword.Checked)
    {
        tBoxPassword.PasswordChar = '\0';   // Display input 
    }
    else
    {
        tBoxPassword.PasswordChar = '*';   // Show *
    }
}

effect

 Insert picture description here

engineering

Portal :

  1. GitHub As a free download
  2. CSDN Free download
原网站

版权声明
本文为[Jack1009HF]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202150511072981.html