📜  c# textboxaccept only numbers - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:02.307000             🧑  作者: Mango

代码示例1
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
    }