Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top