1

In my application I get a number 2.424242E+08 in my label called lbl_price and when i try to convert it to a decimal i get a FormatEception. How can i fix this?

decimal newVat = Convert.ToDecimal(lbl_price.text);
vcmkrtchyan
  • 2,536
  • 5
  • 30
  • 59
  • If you're going to ask people how to fix something, you have to explain what the problem is with the result you're getting and/or what the desired result is. – David Schwartz Sep 22 '14 at 15:11
  • [Convert numbers with exponential notation from string to double or decimal](http://stackoverflow.com/questions/7877855/convert-numbers-with-exponential-notation-from-string-to-double-or-decimal) – Fabio Sep 22 '14 at 15:16

1 Answers1

2

Try:

decimal newVat = decimal.Parse(lbl_price.text, System.Globalization.NumberStyles.Float);
Ben Robinson
  • 21,601
  • 5
  • 62
  • 79