Link to home
Start Free TrialLog in
Avatar of MaxOvrdrv2
MaxOvrdrv2

asked on

Culture Change doesn't Refresh Controls

Hi,

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
Me.refresh()
Application.DoEvents()
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

ASKER CERTIFIED SOLUTION
Avatar of MaxOvrdrv2
MaxOvrdrv2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial