I want to know if the textbox that I enter by keyboard is a number or a letter
if (txtCodigo.Text) { MessageBox.Show("they are numbers"); } else { MessageBox.Show("they are letters"); }
I want to know if the textbox that I enter by keyboard is a number or a letter
if (txtCodigo.Text) { MessageBox.Show("they are numbers"); } else { MessageBox.Show("they are letters"); }
You could implement something like
when you try to parse to numeric
TryParse()
it returns a true/false that you can use to find out if it is a valid number or notYou can make use of
TryParse
to see if conversion to integer of the text is possible. If it is, it is a numeric value. If not, text: