简单的调用了正则表达式进行简单的验证,记下来留着以后备用

1 if ((!Regex.IsMatch(txtID.Text, @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$",RegexOptions.IgnoreCase)))
2 {
3        MessageBox.Show("请输入正确的身份证号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
4        return;
5 
6  }
View Code

相关文章:

  • 2021-09-27
  • 2022-12-23
  • 2022-01-12
  • 2021-12-23
  • 2021-12-23
  • 2021-12-23
  • 2022-03-03
猜你喜欢
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
相关资源
相似解决方案