Oliver
Fri Sep 23 04:57:34 CDT 2005
classAct wrote:
>Decimal.Parse(money_str, NumberStyles.AllowCurrencySymbol) fails when
>money_str = "$22,000.00" (or any currency type string expression created
>with:
>money_str = String.Format( "{0:C}", my_Decimal_variable ); A Format
>Exception is thrown and states that the argument was in an incorrect
>format.
>What is the problem?
You need to use a few more flags from the NumberStyle enum to get it to
work. Conveniently, there's a combined flag called "Currency" that should
make things work for you. Like this:
Decimal.Parse(money_str, NumberStyles.Currency)
See this page (MSDN) for information about the various flags available:
http://shrinkster.com/88q
Oliver Sturm
--
Expert programming and consulting services available
See
http://www.sturmnet.org (try /blog as well)