Test passed values to see if they are numeric or not using the TryParse method on the Double data type.
public static bool IsNumeric(string NumToValidate)
{
if (HasValue(NumToValidate))
{
double NumTest = new double();
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US", true);
return Double.TryParse(NumToValidate, System.Globalization.NumberStyles.Any, cultureInfo.NumberFormat, out NumTest);
}
else
{
return false;
}
}