没有.
But you can try like this: 1.---------------------
作textbox的KeyPress中:
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar != 8))
e.Handled = true;
base.OnKeyPress(e);}说明:
e.KeyChar != 8是为了让退格键起作用2.-----------------------------
If somebody use copy/paste, It also can paste something into the textbox, so and the following code to textchange event.private void textBox1_TextChanged(object sender, System.EventArgs e)
{
if(!System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text,@"^\d*$"))textBox1.Undo();
}