1
Tech Writer 2.2k 1.6m 22y Try something like this (where tb is a TextBox control)
bool isInt = False;
try {
int res = int.Parse(tb.Text);
isInt = True;
}
catch (Exception ex) {
// error because tb.Text is not parsable to an int
}
if (isInt) {
...
}
else {
...
}