标签:tar char handle ext 数字 输入 box har message
textBox1.KeyPress+=TextNumber_KeyPress;
private void TextNumber_KeyPress(object sender, KeyPressEventArgs e)
{
var tb = (TextBox) sender;
if (e.KeyChar != Convert.ToChar(13))
{
if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
{
MessageShow("只能输入数字");
e.Handled = true;
}
}
}
标签:tar char handle ext 数字 输入 box har message
原文地址:http://www.cnblogs.com/cherious/p/6429883.html