/// <summary>
/// 手机号码验证
/// </summary>
/// <param name="MobileNo"></param>
/// <returns></returns>
public static bool IsValidMobileNo(string MobileNo)
{
const string regPattern = @"^13[0-9]{9}$";
return Regex.IsMatch(MobileNo, regPattern);
}
/// <summary>
/// 验证非法字符
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static bool IsValidMobileNo22(string MobileNo)
{
const string regPattern = "[~!@#$%^&*()+|<>///?]";
return Regex.IsMatch(MobileNo, regPattern);
}
private void 身份验证_Click(object sender, System.EventArgs e)
{
string a=textBox2.Text.ToString();
Class1cui ab=new Class1cui();
MessageBox.Show(ab.checkIdcard(a));
}
private void button4_Click(object sender, System.EventArgs e)
{
string aa=textBox4.Text.ToString();
if(IsValidMobileNo22(aa)==true)
{
MessageBox.Show("hahaha");
}
else
{
MessageBox.Show("baaa");
}
}