I have a strange problem, I'm using the code below to test for a phone number, in my tests my code worked fine. The program when live yesterday and someone used the phone number 08720 123 456 and my code failed. Can you tell me why it would return TRUE for 0161 287 1234 and FALSE for 08720 123 456?
Fax Number 1: 0161 287 1234 ---> IsNumber returns TRUE Fax Number 2: 08720 123 456 ---> IsNumber returns FALSE
static bool IsNumber(string value)
{
// Return true if this is a number.
int number1;
return int.TryParse(value, out number1);
}
bool testForFax = IsNumber(faxOrEmail);
if (testForFax == true)
{
backgroundWorker2.RunWorkerAsync(); //send fax
}
else
{
MessageBox.Show("Please enter a fax number.");
}