Finding out if keyed in text is numeric:

//works only for whole numbers
int intDummy;
if (Int32.TryParse(string, out intDummy) {
 //text is numeric
} else {
 //text is not numeric

//this one works for decimals

 try { 
                Decimal cValue = Convert.ToDecimal(stringText);
               //bla bla bla...
            } catch (Exception exc) {
                errorText = "invalid non-numeric value. ";

Leave a Reply.

    About the author

    The author have 12+ years experience in IT Industry with varying job roles from system developer/analyst/consultant positions. Majority of her development, implementation and systems support background focus on Financial/Banking/Credit Solutions.


    November 2010
    October 2010



    RSS Feed