Code:
        private void textBox1_KeyPress( object sender, KeyPressEventArgs e )
        {
            e.Handled = !( new Regex( "[0-9]+" ).IsMatch( e.KeyChar.ToString( ) ) );
        }