C# Number Only Field with Backspace and Paste function
Posted on 2008-10-28
I am working in C# 2008 Express and want to have my text field only accept numbers however still allow backspace and paste insertion. I have pasted in what i have thus far which allows the just numbers and the backspace but I am failing to conquer the paste function. Any help would be great thanks.
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
if ((!Char.IsDigit(e.KeyChar)) && (e.KeyChar != Convert.ToChar(Keys.Back)))
e.Handled = true;