private void btnConfirm_Click(object sender, EventArgs e) { if (txtOldPwd.Text.Trim() == "") { MessageBox.Show("旧密码不能为空"); return; } else if (txtOldPwd.Text.Trim() != user.Pwd) { MessageBox.Show("密码不正确"); return; } else { if (txtNewPwd.Text.Trim() == "") { MessageBox.Show("请输入新密码!"); return; } else { if (txtNewPwd.Text.Trim() != txtConfirmPwd.Text.Trim()) { MessageBox.Show("两次输入密码不一致,请重新输入!"); return; } else { user.Pwd = txtConfirmPwd.Text.Trim(); userBLL.UpdatePwd(user); MessageBox.Show("密码修改成功!"); } } } Login form = new Login(); form.main = main; form.Show(); this.Close(); user = null; }