How can I allow only backspace and digits on a textbox ?
I've tried several solutions but none worked or they half-worked:
My code so far:
private void textBox1_TextChanged(object sender, EventArgs e)
{
try
{
if (textBox1.Text != String.Empty)
textBox1.Clear();
else
value = Convert.ToInt32(textBox1.Text);//store the value from the textbox in variable "value"
}
catch (Exception e1)
{
MessageBox.Show(e1.Message);
}
}
I would like a solution which is limitted only to private void textBox1_TextChanged()