1. 添加控件  
添加控件

C#中设置密码框 ,用符号代替密码

确认键代码

 private void button1_Click(object sender, EventArgs e)
        {
            //修改密码。新密码,重复新密码,两次输入的新密码必须一致。
            
            string newpassword = textBox2.Text;
            string newpassword2 = textBox3.Text;
            
            if (newpassword != newpassword2)
            {
                MessageBox.Show("两次输入的新密码不一致");
                return;
            }            
            MessageBox.Show("修改成功");
        }

关闭键代码

private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

将textBox中的字符转化为*号,设置textBox的属性,将PasswordChar中写入*即可。

C#中设置密码框 ,用符号代替密码

相关文章:

  • 2021-07-25
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2021-09-07
  • 2021-05-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-06-28
  • 2022-01-31
  • 2021-12-02
相关资源
相似解决方案