Ali G

Ali G

  • NA
  • 51
  • 38.5k

A Textbox Validation (Only Doubles) Needs C# Gurus :-)

Dec 28 2012 7:25 AM
I want accept such number formats in my textbox. These numbers are all doubles.

  • 2.6
  • 45e-2
  • 23e32
  • +0.05
  • -0.07e+5

So my textBox must allow these:

  • Maximum one "e" or "E" letter
  • "e" or "E" letter can't be at the end or at the beginning
  • "+" and "-" characters are allowed
  • "+" or "-" character can be only at the beginning of the number or behind the "e" OR "E" letter
  • All conditions must be valid for ctrl+V, mouse paste or typing
  • Maximum one "." charater before a number but not after an "e" letter.

What code do you suggest me? Thanks for all...




Answers (18)