private bool ValidateInfo()//验证输入的信息 { bool b = true; if (string.IsNullOrWhiteSpace(txtJnum.Text)) { MessageBox.Show("工号不能为空!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); return(false); } //限定学号必须为5位数字 if (!ValidataInput.IsJNum(txtJnum.Text)) { MessageBox.Show("工号为必须为10开头的5位数字!", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } return(b); }