0

I have a .NET application available in several different language. i basically load and save file (containing doubles) in the System Culture but i would like to force numbers to always be displayed and entered using the US culture format (comma as digit grouping, period as decimal separator). I tried to override the application Culture but it doesn't seem to work. Is there a way to deal with this?

ak3nat0n
  • 6,060
  • 6
  • 36
  • 59

1 Answers1

1

CultureInfo.InvariantCulture exists for the specific purpose of persisting data in a consistent format. More Info on MSDN

For the UI, if you really want all formatting to be US-style, you can do this:

Application.CurrentCulture = new CultureInfo("en-US");

Note that you would need to set the culture on each thread.

dahlbyk
  • 75,175
  • 8
  • 100
  • 122
  • Would it break the UI if i set Application.CultureInfo = InvariantCulture? – ak3nat0n Jun 26 '09 at 01:17
  • 1
    I guess I misunderstood you. The purpose of InvariantCulture would be to store the doubles in a culture-agnostic way; it should not be used for the UI. For that, I would set Application.CurrentCulture = new CultureInfo("en-US"). – dahlbyk Jun 26 '09 at 01:51