Geeks With Blogs
marocanu2001 technicle blog February 2008 Entries
Convert Currency string back to decimal
I just came upon this issue. I have a textbox that contains a value formatted to currency : Decimal val = 567.3; CultureInfo ci = new CultureInfo("en-GB"); string currency = val.ToString("C", ci); this produces string : "£567.3 " And in another place I needed the number from currency, so I had to convert the formatted currency back to decimal. And here's the tip: string currency = "£567.3 "; CultureInfo ci = new CultureInfo("en-GB"); decimal val = Decimal.Parse(currency , NumberStyles.Currency, ci.NumberFormat); ......

Posted On Tuesday, February 5, 2008 10:44 PM

Copyright © marocanu2001 | Powered by: