Hi All,
I'm am looking to convert a currency string (e.g. "$1,234.56" to a
double value).
It appears this will work:
double val = Convert.ToDouble(Double.Parse*("$123,456.78901",
System.Globalization.NumberSty*les.Currency));
My question is, why doesn't this appear to work (which was my inital
attempt at solving this problem):
double iPurchasePrice = Convert.ToDouble(PurchasePrice,
NumberFormatInfo.CurrentInfo);
It results in the exception:
System.FormatException: Input string was not in a correct format.
It appears to be choking on the "$" symbol. When I remove that it
works. I tried creating my own NumberFormatInfo supplying all of the
Currency related properties including CurrencySymbol, but it still
appears to have problems with the "$" sign.
Anyone know why this might be? Again, the Parse method works fine, I'm
just more curious if anyone had any further insight.
Thanks,
John