1)abc<br /> 2)abc23232<br /> 3)1,23232<br /> 4)1221<br /> 5)-32323
TryParse
true
int checkNumber; if (int.TryParse(TextBox2.Text, out checkNumber) == false) { //Entered number is not interger; } else { if (Convert.ToInt16(TextBox2.Text) < 0) { //Entered no. is negative } else { //Entered no. is positive } }
public bool isNumeric(string val, System.Globalization.NumberStyles NumberStyle) { Double result; return Double.TryParse(val,NumberStyle, System.Globalization.CultureInfo.CurrentCulture,out result); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)