- 添加控件
添加控件
确认键代码
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中写入*即可。