#region 验证是否特殊字符
/// <summary>
/// 验证是否特殊字符
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static bool isspecial(string text)
{
regex regexp = new regex
("[~!@#$%^&*()=+[\\]{}\"'.;:/?><`|!·¥…—()\\-、;:。?,“”‘’》《]");
if (regexp.ismatch(text))
{
return true;
}
else
return false;
}
#endregion
#region 屏蔽特殊字符
private void txt_product_keypress(object sender, keypresseventargs e)
if (lepus.rj.infobase.jscript.isspecial(e.keychar.tostring()))
e.handled = true;
e.handled = false;
原帖地址:http://blog.sina.com.cn/s/blog_7f218dc7010117kv.html