private bool ValidateInput() {
if (txt_IMSI.Text.Trim()=="") {
MessageBox.Show("请输入正确的IMSI","ISMI",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
txt_IMSI.Focus();
return false;
}
if (!Regex.Match(txt_IMSI.Text.Trim(),"^[0-9]*$").Success) {//必须是数字
MessageBox.Show("请输入正确的IMSI", "ISMI", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txt_IMSI.Focus();
return false;
}
if(!Regex.Match(txt_IMSI.Text.Trim(), "^\\d{15}$").Success) { //必须是15位
MessageBox.Show("请输入正确的IMSI", "ISMI", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txt_IMSI.Focus();
return false;
}
return true;
}