I'm trying to validate a textbox to check that it has a phone number type value entered.
The problem I'm having is that even when the entry is for example: "blah" in these text boxes the Regex is still returning false and no error message is shown.
Regex staffNumVal = new Regex(@"^[a-z]+$");
if (staffNumVal.IsMatch(txtStaffHPhone.Text)||(staffNumVal.IsMatch(txtStaffHourRate.Text)))
{
MessageBox.Show("Please enter a numeric value");
}
Is there a better way to do this that I'm missing? Thanks.