473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Currency Formatting

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.CurrentCultu re.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
Jul 21 '05 #1
2 3602
Please disregard...
"Vlad" <RE***************@comcast.net> wrote in message
news:#t**************@TK2MSFTNGP11.phx.gbl...
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.CurrentCultu re.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

Jul 21 '05 #2
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

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hung Huynh | last post by:
Is there an easy way to change Currency formatting from USD to EUR (use comma as decimals delimiter instead of period)? I'm using Windows 2000 Server/IIS 5.0 in English. I'm serving both USD and...
2
by: Dalan | last post by:
This should not be an issue, but it is. I'm sure that someone knows what little piece of code is needed too persuade Access 97 to include a currency format for labels (Avery, mailing type). Have...
3
by: Melissa | last post by:
I have several fields in my database specified as Currency data type. Is there a way globally to set these fields not to display the dollar sign? Thanks! Melissa
4
by: Gerry Abbott | last post by:
Hi All. How can i put a zero decimal for my currency into my format statement, == & ", for " & & " days. Cost " & Format(,"Currency") which is the data source for a textbox on a report
1
by: Tom Keane | last post by:
Hi, I need some helpings again! I have a query from one of my tables that gets a total amount of money and gets a percentage from it ie, the field I create in the query is invGSTAmount from a...
3
by: Vlad | last post by:
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...
4
by: Mitchell Vincent | last post by:
How is everyone formatting currency with VB.NET? Before I was calling the API function for it, which took the currency symbol from the Windows settings. I've found this to be limited when...
18
by: Boris Yeltsin | last post by:
OK, I have a database table, it has prices of products in it, like so: ProductPrice MONEY ProductIsoCurrencyCode CHAR(3) Now, both CultureInfo and RegionInfo have...
14
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
18
by: maxpirate | last post by:
The currency values are displayed in format of the regional settings specified in the computer of the user. I would like to display all the currency values in dollar format irrespective of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.