473,395 Members | 1,556 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,395 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 3600
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.