How do I read user's regional settings ?

  • Thread starter Thread starter Emmanuel
  • Start date Start date
E

Emmanuel

I want to know the decimal separator and the group separator character
that the user has set in Regional Settings in Control Panel.

I tryied to use System.Globalization.NumberFormatInfo.CurrentInfo like
that:

NumberFormatInfo numInfo =
System.Globalization.NumberFormatInfo.CurrentInfo;
string ds = numInfo.CurrencyDecimalSeparator;
string gs = numInfo.CurrencyGroupSeparator;

These properties do not contain the values that the user has selected
from the "Regional Settings" but the proper values for the current
language.

This means that if the user has selected: "English (United Kindom)"
from the "Regional Settings" and then has changed the values of
separators using the "Customize" button, the above code will return
the proper separators for "English (United Kindom)" and not the custom
ones.

How can I read the separators that the user has selected from regional
settings ?


Thanks

Emmanuel
 
How can I read the separators that the user has selected from regional
settings ?

Have a look at the CurrentCulture property - it should give you access
to all the settings you're interested in. It will be initialized to
whatever the user has defined in his regional settings (as far as I
can tell).

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Thank you Marc, but unfortunatelly it doesn't. It returns the default
settings for the current culture and not the user customized settings.

Any other ideas ?

Emmanuel
 
Thank you Marc, but unfortunatelly it doesn't. It returns the default
settings for the current culture and not the user customized settings.

Any other ideas ?

There's also a CurrentUICulture - not sure if that might work.

Marc
 
Back
Top