private void TxtBox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsNumber(e.KeyChar);
if (!e.Handled)
{
(sender as TextBox).Tag = (sender as TextBox).Text;
}
else if(char.IsControl(e.KeyChar))
{
e.Handled = !e.Handled;
}
}
C# TextBox只能输入数字(不包括点号)
最新推荐文章于 2022-11-25 19:17:01 发布