private bool ValidateInput() { if (TxtLoginId.Text == "") { MessageBox.Show("请输入用户名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginId.Focus(); return(false); } if (TxtLoginPwdAgain.Text == "") { MessageBox.Show("请输入密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginPwdAgain.Focus(); return(false); } if (TxtLoginPwdAgain.Text == "") { MessageBox.Show("请输入密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginPwdAgain.Focus(); return(false); } if (!(TxtLoginPwd.Text == TxtLoginPwdAgain.Text)) { MessageBox.Show("两次输入密码不一致", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginPwdAgain.Focus(); return(false); } if (!RadioActive.Checked && !RadioInActive.Checked) { MessageBox.Show("请设置用户状态", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); RadioActive.Focus(); return(false); } if (TxtStudentName.Text == "") { MessageBox.Show("请输入学员姓名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtStudentName.Focus(); return(false); } if (TxtId.Text == "") { MessageBox.Show("请输入学员学号", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtId.Focus(); return(false); } if (!RadioMale.Checked && !RadioFemale.Checked) { MessageBox.Show("请选择学员性别", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); RadioMale.Focus(); return(false); } if (CboClass.Text == "") { MessageBox.Show("请选择学员班级", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CboClass.Focus(); return(false); } return(true); }
/// <summary> /// 查询方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSelect_Click(object sender, EventArgs e) { if (TxtLoginId.Text == "") { MessageBox.Show("请输入用户名", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginId.Focus(); } else { FillListView(); } }