سلام

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{

if (e.KeyChar < '0' || e.KeyChar > '9')
e.Handled = true;
}