How to validate decimal value in textbox using C#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • s k parimal

    How to validate decimal value in textbox using C#?

    How to validate decimal value in textbox using C#?

    I am using this (^([0-9]*|\d*\d{1}?\d*) $)
    but it not working
    help
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you are aware that your regular expression could be simplified to ^\d*$?

    Comment

    • GaryTexmo
      Recognized Expert Top Contributor
      • Jul 2009
      • 1501

      #3
      As an alternative to regular expressions, check out the double type's TryParse method.

      Converts the string representation of a number to its double-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

      Comment

      Working...