 <p>A slightly cleaner format of the above:</p> <pre><code> private void amount_PaidTextBox_KeyPress(object sender, KeyPressEventArgs e) { e.Handled = !(Char.IsNumber(e.KeyChar) || (e.KeyChar==Keys.Back)); } </code></pre>