PC Review


Reply
Thread Tools Rate Thread

Currency Formatting

 
 
Vlad
Guest
Posts: n/a
 
      25th May 2004
Hi,

I am trying to display a currency value formated according to the current
culture in ASP.NET:
decimal x = 125345.54M;
string currencyString = String.Format("{0:c}",x);
what gets retured is 125,345.54 without the currency symbol of $

I checked and re-checked my regional settings and tried it on other PCs
without success...

When I put a breakpoint and view the following in the Immediate window I see
that the AnsiCurrencySymbol is null and the CurrencySymbol is "" for some
reason:
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat

{System.Globalization.NumberFormatInfo}

System.Object: {System.Globalization.NumberFormatInfo}
ansiCurrencySymbol: null
AnsiCurrencySymbol: null
CurrencyDecimalDigits: 2
currencyDecimalDigits: 2
CurrencyDecimalSeparator: "."
currencyDecimalSeparator: "."
currencyGroupSeparator: ","
CurrencyGroupSeparator: ","
CurrencyGroupSizes: {Length=1}
currencyGroupSizes: {Length=1}
CurrencyNegativePattern: 0
currencyNegativePattern: 0
CurrencyPositivePattern: 0
currencyPositivePattern: 0
CurrencySymbol: ""
currencySymbol: ""
CurrentInfo: {System.Globalization.NumberFormatInfo}
InvariantInfo: {System.Globalization.NumberFormatInfo}
invariantInfo: {System.Globalization.NumberFormatInfo}
IsReadOnly: false
isReadOnly: false
m_dataItem: 41
m_useUserOverride: true
NaNSymbol: "NaN"
nanSymbol: "NaN"
negativeInfinitySymbol: "-Infinity"
NegativeInfinitySymbol: "-Infinity"
NegativeSign: "-"
negativeSign: "-"
NumberDecimalDigits: 2
numberDecimalDigits: 2
NumberDecimalSeparator: "."
numberDecimalSeparator: "."
NumberGroupSeparator: ","
numberGroupSeparator: ","
NumberGroupSizes: {Length=1}
numberGroupSizes: {Length=1}
numberNegativePattern: 1
NumberNegativePattern: 1
PercentDecimalDigits: 2
percentDecimalDigits: 2
percentDecimalSeparator: "."
PercentDecimalSeparator: "."
PercentGroupSeparator: ","
percentGroupSeparator: ","
percentGroupSizes: {Length=1}
PercentGroupSizes: {Length=1}
PercentNegativePattern: 0
percentNegativePattern: 0
percentPositivePattern: 0
PercentPositivePattern: 0
percentSymbol: "%"
PercentSymbol: "%"
PerMilleSymbol: "?"
perMilleSymbol: "?"
PositiveInfinitySymbol: "Infinity"
positiveInfinitySymbol: "Infinity"
positiveSign: "+"
PositiveSign: "+"
validForParseAsCurrency: true
validForParseAsNumber: true

I thought that the CurrentCultureInfo takes its information from the
regional settings of the PC...

Please help!

Thanks,

Vlad


 
Reply With Quote
 
 
 
 
Vlad
Guest
Posts: n/a
 
      25th May 2004
Please disregard...
"Vlad" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
>
> I am trying to display a currency value formated according to the current
> culture in ASP.NET:
> decimal x = 125345.54M;
> string currencyString = String.Format("{0:c}",x);
> what gets retured is 125,345.54 without the currency symbol of $
>
> I checked and re-checked my regional settings and tried it on other PCs
> without success...
>
> When I put a breakpoint and view the following in the Immediate window I

see
> that the AnsiCurrencySymbol is null and the CurrencySymbol is "" for some
> reason:
> System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat
>
> {System.Globalization.NumberFormatInfo}
>
> System.Object: {System.Globalization.NumberFormatInfo}
> ansiCurrencySymbol: null
> AnsiCurrencySymbol: null
> CurrencyDecimalDigits: 2
> currencyDecimalDigits: 2
> CurrencyDecimalSeparator: "."
> currencyDecimalSeparator: "."
> currencyGroupSeparator: ","
> CurrencyGroupSeparator: ","
> CurrencyGroupSizes: {Length=1}
> currencyGroupSizes: {Length=1}
> CurrencyNegativePattern: 0
> currencyNegativePattern: 0
> CurrencyPositivePattern: 0
> currencyPositivePattern: 0
> CurrencySymbol: ""
> currencySymbol: ""
> CurrentInfo: {System.Globalization.NumberFormatInfo}
> InvariantInfo: {System.Globalization.NumberFormatInfo}
> invariantInfo: {System.Globalization.NumberFormatInfo}
> IsReadOnly: false
> isReadOnly: false
> m_dataItem: 41
> m_useUserOverride: true
> NaNSymbol: "NaN"
> nanSymbol: "NaN"
> negativeInfinitySymbol: "-Infinity"
> NegativeInfinitySymbol: "-Infinity"
> NegativeSign: "-"
> negativeSign: "-"
> NumberDecimalDigits: 2
> numberDecimalDigits: 2
> NumberDecimalSeparator: "."
> numberDecimalSeparator: "."
> NumberGroupSeparator: ","
> numberGroupSeparator: ","
> NumberGroupSizes: {Length=1}
> numberGroupSizes: {Length=1}
> numberNegativePattern: 1
> NumberNegativePattern: 1
> PercentDecimalDigits: 2
> percentDecimalDigits: 2
> percentDecimalSeparator: "."
> PercentDecimalSeparator: "."
> PercentGroupSeparator: ","
> percentGroupSeparator: ","
> percentGroupSizes: {Length=1}
> PercentGroupSizes: {Length=1}
> PercentNegativePattern: 0
> percentNegativePattern: 0
> percentPositivePattern: 0
> PercentPositivePattern: 0
> percentSymbol: "%"
> PercentSymbol: "%"
> PerMilleSymbol: "?"
> perMilleSymbol: "?"
> PositiveInfinitySymbol: "Infinity"
> positiveInfinitySymbol: "Infinity"
> positiveSign: "+"
> PositiveSign: "+"
> validForParseAsCurrency: true
> validForParseAsNumber: true
>
> I thought that the CurrentCultureInfo takes its information from the
> regional settings of the PC...
>
> Please help!
>
> Thanks,
>
> Vlad
>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      26th May 2004
Hi Vlad,

I'm viewing the post and find it is a duplicated one with another in the
Newsgroups: microsoft.public.dotnet.framework.aspnet group,
I've posted my reply and provided my suggestion there. Would you have a
look.
Also, if you still have any question, please feel free to post there.
Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
currency formatting =?Utf-8?B?cm9kY2hhcg==?= Microsoft C# .NET 1 2nd Oct 2007 05:43 PM
Formatting for Currency =?Utf-8?B?TG91aXNx?= Microsoft Word Document Management 2 14th Jul 2006 04:58 PM
Currency Formatting Rob Microsoft Access Form Coding 2 20th May 2004 05:13 PM
Currency formatting Edwin Microsoft Dot NET 2 21st Jul 2003 06:37 AM
Currency Formatting Aaron Microsoft Excel Worksheet Functions 1 12th Jul 2003 03:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:45 AM.