You can use the Microsoft.VisualBasic.Information.IsNumeric is numeric function. Just add the reference Microsoft.VisualBasic
private void textBox1_Validating(object sender,
System.ComponentModel.CancelEventArgs e) {
if (!Microsoft.VisualBasic.Information.IsNumeric(textBox1.Text)) {
e.Cancel = true;
} else {
// Do something here
}
}
This allows the user to enter scientific notation which is not trivial to filter for.