Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 formatting currency

Author  Topic 

shemayb
Posting Yak Master

159 Posts

Posted - 2008-01-16 : 04:15:40
What is the correct syntax for formatting currency in C#?For example i wanted my result to look like this:$4,000.00..

Funnyfrog

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-16 : 05:02:29
What do your help file tell you for FORMAT function?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

shemayb
Posting Yak Master

159 Posts

Posted - 2008-01-16 : 05:06:11

string charges = string.Format("{0:c}", total_charges);

that is my code but it's not working.

Funnyfrog
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-01-16 : 08:05:29
How is the variable total_charges declared? What data type? Where is it being set? What do you mean by "it is not working?" Are you getting an error, is it displaying wrong, etc?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

shemayb
Posting Yak Master

159 Posts

Posted - 2008-01-16 : 19:58:39
total charges is declared as integer.
the format that i am using is not really doing something in the results.

Funnyfrog
Go to Top of Page

hey001us
Posting Yak Master

185 Posts

Posted - 2008-01-16 : 20:30:50
Can you post the expected format?
hey
Go to Top of Page

shemayb
Posting Yak Master

159 Posts

Posted - 2008-01-16 : 22:01:30
thanks for all your help..I already solved my problem...Thanks!

Funnyfrog
Go to Top of Page
   

- Advertisement -