private void txtNumOnly_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8)
{
//键盘操作是否完成,Handled表示已经处理过
e.Handled = true;
}
else
{
//MessageBox.Show(e.KeyChar.ToString());
}
}