Culture Change doesn't Refresh Controls

Posted on 2010-03-24
Medium Priority
Last Modified: 2012-05-09

I have an application that allows the user to change the language at will during run time. However, i am running into a small problem when it comes to controls on forms. Actually, the only place where the problem occurs is on dialog forms. Here are the steps i am taking to reproduce the error:

1 start application
2 open search and perform search
3 select record, and hit @View@ (dialog form)
4 Hit cancel
5 Change the language (this changes my search form controls without problems (MDI Child form), and the thread culture as well)
6 Perform a search
7 select same record, and hit @View@ (dialog form)

At this point, all of my controls within the dialog form are in the previous language/haven't changed.

I am wondering if there is anything special i should be doing to refresh the controls to the proper UI culture. I know that the UI culture has properly been changed because part of the dialog box content is pulled from the DB based on the current culture... so that textbox content is in the proper language, but the controls on the dialog box remain unchanged.

I have tried many things to get this to work, including:

Form Load Event
InitializeComponent() (this effectively clears my entire form, not what i want)

Debug and check that the culture has been changed (it has) on dialog form load...

I am at a loss as to why this only happens on the dialog boxes... all my other forms perform properly. Here's the code to change the culture, maybe something is wrong there... please help! :
Public Sub SetLanguageCulture()
        If LanguageCode = "F" Then
            m_CurrentCulture = New CultureInfo("fr-CA")
            Threading.Thread.CurrentThread.CurrentUICulture = m_CurrentCulture
            Threading.Thread.CurrentThread.CurrentCulture = m_CurrentCulture
        ElseIf LanguageCode = "E" Then
            m_CurrentCulture = New CultureInfo("en-CA")
            Threading.Thread.CurrentThread.CurrentUICulture = m_CurrentCulture
            Threading.Thread.CurrentThread.CurrentCulture = m_CurrentCulture
        End If
    End Sub

Open in new window

Question by:MaxOvrdrv2
1 Comment
LVL 10

Accepted Solution

MaxOvrdrv2 earned 0 total points
ID: 28457416
Ah man... i hate it when this happens... =S I actually found the answer to my problem... the reason why the dialog boxes were not changing UI cultures is that apparently, Me.Close(), keeps all the language culture information into memory somehow... i decided to try Me.Dispose() instead, and it works properly for all my dialog boxes now... really sorry for the useless post.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question