using System; using System.Text; using System.Text.RegularExpressions; private bool IsTextValidated(string strTextEntry) { System.Text.RegularExpressions.Regex objNotWholePattern = new System.Text.RegularExpressions.Regex("[^0-9]"); return !objNotWholePattern.IsMatch(strTextEntry) && (strTextEntry != ""); }
public static bool IsNumeric1(object numberString) { char[] ca = numberString.ToString().ToCharArray(); for (int i = 0; i < ca.Length; i++) { if (!char.IsNumber(ca[i])) if (ca[i] != '.') return false; } if (numberString.ToString().Trim() == "") return false; return true; }
public static bool IsInteger(string theValue) { try { Convert.ToInt32(theValue); return true; } catch { return false; } }
public bool Isnumeric2(string numberString) { int resposta = 0; return System.Int32.TryParse(numberString, out resposta); }