Change vb.net website language from button event RRS feed

  • Question

  • User-957010854 posted
    Hi all,

    I added to my website in vb.net a LocalResource with a translated content in .resx archives. The translation works properly based on the browser language but i want to change the language from the same page. For this I added the following code in the button event:
    System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("fr-FR")
    System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("fr-FR")
    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("fr")
    System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("fr")

    It does not work, the page stills with the same language.

    Anyone know how I can change it?

    Thank you in advance.
    Sunday, August 14, 2011 7:11 AM

All replies

  • User-758443495 posted

    you have to set resources to your controls

    see :


    Sunday, August 14, 2011 7:27 AM
  • User-276842610 posted

    Hi vfortuny,

    Please refer MSDN article about how to set the current UI culture and current culture


    Hope this helps, thanks.

    Tuesday, August 16, 2011 2:13 AM
  • User-957010854 posted


    The problem was that i can't put "Protected Overrides Sub InitializeCulture()" in the master page, therefore, i have to put initializeculture in all the aspx pages?

    Tuesday, August 16, 2011 2:19 AM
  • User1335250097 posted

    You can do as follow:

    1. Put button "Change language" to master page.

    2. Put handler that get button event of master page to your .aspx page

    3. Put in the handler you code for change culture.

    I believe you easily can find sample of getting event from master page on asp.net learn chapters

    Tuesday, August 16, 2011 12:43 PM