1.在textBox的事件中加入KeyPress事件。
2.然后在代码中实现。问题解决。
private void Threshold_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
}
1.在textBox的事件中加入KeyPress事件。
2.然后在代码中实现。问题解决。
private void Threshold_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
}