473,672 Members | 2,597 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 AnsiCurrencySym bol is null and the CurrencySymbol is "" for some
reason:
System.Threadin g.Thread.Curren tThread.Current Culture.NumberF ormat

{System.Globali zation.NumberFo rmatInfo}

System.Object: {System.Globali zation.NumberFo rmatInfo}
ansiCurrencySym bol: null
AnsiCurrencySym bol: null
CurrencyDecimal Digits: 2
currencyDecimal Digits: 2
CurrencyDecimal Separator: "."
currencyDecimal Separator: "."
currencyGroupSe parator: ","
CurrencyGroupSe parator: ","
CurrencyGroupSi zes: {Length=1}
currencyGroupSi zes: {Length=1}
CurrencyNegativ ePattern: 0
currencyNegativ ePattern: 0
CurrencyPositiv ePattern: 0
currencyPositiv ePattern: 0
CurrencySymbol: ""
currencySymbol: ""
CurrentInfo: {System.Globali zation.NumberFo rmatInfo}
InvariantInfo: {System.Globali zation.NumberFo rmatInfo}
invariantInfo: {System.Globali zation.NumberFo rmatInfo}
IsReadOnly: false
isReadOnly: false
m_dataItem: 41
m_useUserOverri de: true
NaNSymbol: "NaN"
nanSymbol: "NaN"
negativeInfinit ySymbol: "-Infinity"
NegativeInfinit ySymbol: "-Infinity"
NegativeSign: "-"
negativeSign: "-"
NumberDecimalDi gits: 2
numberDecimalDi gits: 2
NumberDecimalSe parator: "."
numberDecimalSe parator: "."
NumberGroupSepa rator: ","
numberGroupSepa rator: ","
NumberGroupSize s: {Length=1}
numberGroupSize s: {Length=1}
numberNegativeP attern: 1
NumberNegativeP attern: 1
PercentDecimalD igits: 2
percentDecimalD igits: 2
percentDecimalS eparator: "."
PercentDecimalS eparator: "."
PercentGroupSep arator: ","
percentGroupSep arator: ","
percentGroupSiz es: {Length=1}
PercentGroupSiz es: {Length=1}
PercentNegative Pattern: 0
percentNegative Pattern: 0
percentPositive Pattern: 0
PercentPositive Pattern: 0
percentSymbol: "%"
PercentSymbol: "%"
PerMilleSymbol: "?"
perMilleSymbol: "?"
PositiveInfinit ySymbol: "Infinity"
positiveInfinit ySymbol: "Infinity"
positiveSign: "+"
PositiveSign: "+"
validForParseAs Currency: true
validForParseAs Number: true

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

Please help!

Thanks,

Vlad
Jul 21 '05 #1
2 3631
Please disregard...
"Vlad" <RE************ ***@comcast.net > wrote in message
news:#t******** ******@TK2MSFTN GP11.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 AnsiCurrencySym bol is null and the CurrencySymbol is "" for some
reason:
System.Threadin g.Thread.Curren tThread.Current Culture.NumberF ormat

{System.Globali zation.NumberFo rmatInfo}

System.Object: {System.Globali zation.NumberFo rmatInfo}
ansiCurrencySym bol: null
AnsiCurrencySym bol: null
CurrencyDecimal Digits: 2
currencyDecimal Digits: 2
CurrencyDecimal Separator: "."
currencyDecimal Separator: "."
currencyGroupSe parator: ","
CurrencyGroupSe parator: ","
CurrencyGroupSi zes: {Length=1}
currencyGroupSi zes: {Length=1}
CurrencyNegativ ePattern: 0
currencyNegativ ePattern: 0
CurrencyPositiv ePattern: 0
currencyPositiv ePattern: 0
CurrencySymbol: ""
currencySymbol: ""
CurrentInfo: {System.Globali zation.NumberFo rmatInfo}
InvariantInfo: {System.Globali zation.NumberFo rmatInfo}
invariantInfo: {System.Globali zation.NumberFo rmatInfo}
IsReadOnly: false
isReadOnly: false
m_dataItem: 41
m_useUserOverri de: true
NaNSymbol: "NaN"
nanSymbol: "NaN"
negativeInfinit ySymbol: "-Infinity"
NegativeInfinit ySymbol: "-Infinity"
NegativeSign: "-"
negativeSign: "-"
NumberDecimalDi gits: 2
numberDecimalDi gits: 2
NumberDecimalSe parator: "."
numberDecimalSe parator: "."
NumberGroupSepa rator: ","
numberGroupSepa rator: ","
NumberGroupSize s: {Length=1}
numberGroupSize s: {Length=1}
numberNegativeP attern: 1
NumberNegativeP attern: 1
PercentDecimalD igits: 2
percentDecimalD igits: 2
percentDecimalS eparator: "."
PercentDecimalS eparator: "."
PercentGroupSep arator: ","
percentGroupSep arator: ","
percentGroupSiz es: {Length=1}
PercentGroupSiz es: {Length=1}
PercentNegative Pattern: 0
percentNegative Pattern: 0
percentPositive Pattern: 0
PercentPositive Pattern: 0
percentSymbol: "%"
PercentSymbol: "%"
PerMilleSymbol: "?"
perMilleSymbol: "?"
PositiveInfinit ySymbol: "Infinity"
positiveInfinit ySymbol: "Infinity"
positiveSign: "+"
PositiveSign: "+"
validForParseAs Currency: true
validForParseAs Number: true

I thought that the CurrentCultureI nfo 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.publi c.dotnet.framew ork.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
3317
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 EUR dynamically from the same source codes. I'd like to change Currency formatting automatically when a person chooses EUR. Thanks! HH
2
9604
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 had no problems with currency formatting on reports - just the labels. Doesn't matter if the associated field in the Table and Form have Format as Currency, because on the labels (for instance $50.00) prints as: 50 The only way to get it to print...
3
13449
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
22589
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
3812
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 field in my table called invAmount, so I but in the design view of my query: invGSTAmount: *1/11
3
2260
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 125,345.54 without the currency symbol of $ I checked and re-checked my regional settings and tried it on other PCs without success...
4
2021
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 working with European countries where business in conducted in several different currencies. Are you guys just storing a currency symbol and formatting the number accordingly? What about the comma and decimal switch that some locales use? I hope .NET...
18
6179
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 currency-handling functions inside them, but I want to display the price on my web site given the information above, plus the current culture of the web site visitor. So, I have
14
4321
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 unformatted data values (as decimals) just fine, so I know there's not a problem with the data retrieval, just the formatting. I have read that this would work: lblPrice.Text = prodRow.ToString("C");
18
8119
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 regional settings. i tried formatting the currency columns as $#.##0,00;($#.##0,00) but it still shows values in regional formats. Is there a way to specify an application specific setting.
0
8486
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6238
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5705
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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 we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.