String.Format {0:C} works for UK pounds and not US dollars

Posted on 2007-07-20
Last Modified: 2008-02-20

I'm developing and application using c#.
I need to display a currency value on screen.

double OrderCost = 10.99;
string sOrderCost = String.Format("{0:C}", OrderCost);

This line works fine and displays the value as £10.99 (I'm developing it in the UK)
However if I change my regional settings to English (United States) and run the application
the value is displayed on screen in pounds and not dollars.

Can the string.format function handle this or do I need to implement more code??

Please help, Ruairi.

Question by:CoreSupport
    LVL 12

    Expert Comment

    are you changing the regional settings on the server or on the client machine?
    LVL 29

    Accepted Solution

    Dear CoreSupport,
    You can override the regional setting in web.config.
      <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-GB">

    You can check more details regarding culture settings here:

    Complete culture list to apply:

    Author Comment

    Hi craskin, I was changing the regional settings on the server and running the applicaiton on the server.

    x com, that worked. Thanks!

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now