1

I am trying to set the culture information for my Thread

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-DE");

Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");

Above is the culture I have set, this works well on number formats for converting decimal information, I am trying to set the thousands separator and I dont know a way without having to set it on the gridview level or using a string.Format.

Does anyone know how to set the thousands separator at the thread culture level ?

John Arlen
  • 6,539
  • 2
  • 33
  • 42
Kirit Chandran
  • 679
  • 7
  • 13
  • @Krit, have you tried `Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");`? – Devendra D. Chavan Mar 10 '11 at 17:17
  • The above code is pretty much doing that I believe. I did give it a quick try though, and still the same. – Kirit Chandran Mar 10 '11 at 17:26
  • I believe Kirit is asking to have the thousands separator display by default for the current thread, instead of needing to specify this in an overload of .ToString(), such as .ToString("N") – JeremyDWill Mar 10 '11 at 17:48

2 Answers2

2

This seems to work:

    Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
    Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture;

    Thread.CurrentThread.CurrentUICulture.NumberFormat.CurrencyGroupSeparator = "|";

    String Test = 123456789.ToString("C");
Steve Wellens
  • 20,506
  • 2
  • 28
  • 69
  • I think Kirit is trying to find a setting at the thread's scope that indicates the default setting is to display the thousands separator, so that it would not be necessary to call an overload of ToString to explicitly obtain the thousand's separator. – JeremyDWill Mar 10 '11 at 17:57
  • Thanks JeremyDwill, that is exactly what I am trying to accomplish – Kirit Chandran Mar 10 '11 at 18:10
1

I'm not sure if I understand your question correctly, but did you try changing it with the property CultureInfo.NumberFormat.NumberGroupSeparator?

grysik44
  • 233
  • 2
  • 7