none
.Net 4.0 Runtime changes CuurentCulture on its own RRS feed

  • Question

  • Hello,

    I have the following problem,

    at least on a german 64bit Windows 7 and .Net 4.0 using C#.

    I do the following

    using  System.Threading:
    using  System.Globalization:
    
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-Us");
    Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-Us");
    
    MyForm mf = new Myform();
    mf.ShowDialog();
    

    My problem is now, that in some event handler routines

    CurrentThread.CurrentCulture (and CurrentThread.CurrentUICulture) has chamged to "de-DE".

    I have different forms and and not in all the change happens in the sampe place.

    With form1 the change has already taken place when the VisibleChanged event handler is called,

    with form2 CurrentCulture is still "en-Us" when the VisibleChanged event handler is called.

    Form2 has several checkboxes, all unmarked at start. When I then mark the first checkbox,

    then CurrentCulture is "de-DE" when the CheckChanged event handler is called.

    At least CurrentThread.ManagedThreadId. has not changed.

    Is there a way to tell the runtime not to change the CurrentThread.CurrentCulture on its own ?

    with best regards

      Hendrik Schmieder

    Friday, February 14, 2014 10:35 AM

Answers

All replies

  • Hi Hendrik,

    >Is there a way to tell the runtime not to change the CurrentThread.CurrentCulture on its own?

    Not use and not change, I think. You can refer to the following link and try those work around. And let me know the result.

    http://stackoverflow.com/questions/11711426/proper-way-to-change-language-at-runtime.

    Hope useful.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 17, 2014 2:27 AM
    Moderator
  • Just found a simple testcase:

    Calling

    System.Windws.Forms.MessageBox.Show(string, string) is enough.

    Before the call MessageBox.Show(...,..)

    System.Threading.Thread.CurrentThread.CurrentCulture is en-US, but

    after the MessageBox.Show(...,..) CurrentThread.CurrentCulture  is back to system default

    which is de-De in my case.

    with best regards

      Hendrik Schmieder

    Friday, March 21, 2014 9:18 AM