As it stands, the TryParse
method will fail if the string contains commas. E.g., 10,000. To get around this, you can use:
bool isnumber=int.TryParse(text,System.Globalization.NumberStyles.Integer |
System.Globalization.NumberStyles.AllowThousands,
System.Globalization.CultureInfo.CurrentCulture, out n);