Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to change Language? [modified]

How to change Language? [modified]

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ian Wells
    wrote on last edited by
    #1

    Hi all, I've created a form which is in English, and would also like it to be displayed French and Spanish via a combobox? I have created a combobox(cboLanguage) and added English, Franch & Spanish too it and added the following code: Dim Language As String Language = cboLanguage.Text If Language = "French" Then Me.lblTitle.Text = ("Titre") Me.lblFirstName.Text = ("Prenom") Me.lblLastName.Text = ("Dernier nom") Else : Me.lblTitle.Text = ("Title") Me.lblFirstName.Text = ("First Name") Me.lblLastName.Text = ("Last Name") End If This all works Ok, but can be very time comsuming esp if your doing muliple Languages on many forms. Can anyone tell me if there is a simlpe way for doing this??? Many Thanks Ian Wells -- modified at 8:34 Sunday 9th September, 2007 Ian Wells

    C J 2 Replies Last reply
    0
    • I Ian Wells

      Hi all, I've created a form which is in English, and would also like it to be displayed French and Spanish via a combobox? I have created a combobox(cboLanguage) and added English, Franch & Spanish too it and added the following code: Dim Language As String Language = cboLanguage.Text If Language = "French" Then Me.lblTitle.Text = ("Titre") Me.lblFirstName.Text = ("Prenom") Me.lblLastName.Text = ("Dernier nom") Else : Me.lblTitle.Text = ("Title") Me.lblFirstName.Text = ("First Name") Me.lblLastName.Text = ("Last Name") End If This all works Ok, but can be very time comsuming esp if your doing muliple Languages on many forms. Can anyone tell me if there is a simlpe way for doing this??? Many Thanks Ian Wells -- modified at 8:34 Sunday 9th September, 2007 Ian Wells

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You factor out all of your display strings into a config file, and then create a different file for each language. Then, once your code selects what file to get it's values from, it's just going to work everywhere.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • I Ian Wells

        Hi all, I've created a form which is in English, and would also like it to be displayed French and Spanish via a combobox? I have created a combobox(cboLanguage) and added English, Franch & Spanish too it and added the following code: Dim Language As String Language = cboLanguage.Text If Language = "French" Then Me.lblTitle.Text = ("Titre") Me.lblFirstName.Text = ("Prenom") Me.lblLastName.Text = ("Dernier nom") Else : Me.lblTitle.Text = ("Title") Me.lblFirstName.Text = ("First Name") Me.lblLastName.Text = ("Last Name") End If This all works Ok, but can be very time comsuming esp if your doing muliple Languages on many forms. Can anyone tell me if there is a simlpe way for doing this??? Many Thanks Ian Wells -- modified at 8:34 Sunday 9th September, 2007 Ian Wells

        J Offline
        J Offline
        Jelle Hissink
        wrote on last edited by
        #3

        A different solution could be: - Use the visual studio designer to localize the form (search for "localizing vb.net forms" on google) - Then set the System.Thread.CurrentCulture to the value you want in the combobox selection changed event. - On every control you could reapply the localized resources: (translated to vb.net, not compiled so it may contain some small errors) Dim resources as System.ComponentModel.ComponentResourceManager = _ new System.ComponentModel.ComponentResourceManager(GetType(YourForm)) For Each c as Control in Me.Controls resources.ApplyResources(c, c.Name) Next Regards, Jelle Hissink

        http://www.CodeWise.nl

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups