private void txtquanwen_TextChanged(object sender, EventArgs e)
{
string putter = "[^%&',;=?$\x22]+";
if (!CheckIsFormat(putter, this.txtquanwen.Text))
{
if (txtquanwen.Text == "")
{
txtqwbeforevalue = "";
}
else
{
txtquanwen.Text = txtqwbeforevalue;
}
}
else
{
txtqwbeforevalue = this.txtquanwen.Text;
}
}
public static bool CheckIsFormat(string strRegex, string strValue)
{
if (strValue != null && strValue.Trim() != "")
{
Regex re = new Regex(strRegex);
if (re.IsMatch(strValue))
{
return true;
}
else
{
return false;
}
}
return false;
}