473,513 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3608
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
3303
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
9592
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
13354
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
22575
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
3785
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
2249
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
2018
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
6162
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
4253
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
8080
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
7260
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
7161
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
7384
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
7539
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
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.