private void txtA_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(),"[0-9]"))
{
e.Handled = true;
return;
}
}
转载于:https://www.cnblogs.com/lfofiug/archive/2011/08/11/2134591.html