Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / April 2007

Tip: Looking for answers? Try searching our database.

Problems with Multilanguage

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
spig.marco@gmail.com - 01 Apr 2007 13:06 GMT
Hi to all!,

I've downloaded .net Framework SDK 2.0 and I have VB.NET2005 Express
Edition, I would like to create multilanguage systems that changes
with radio button.
With Windows Localization Resource I changed the label of my
FrmMain.vb! and created automaticaly FrmMain.en.resx.
When i lunch the command in FrmMain_load()
...
       Thread.CurrentThread.CurrentUICulture = New CultureInfo("en")
...
Doesn't  happen anything!

That's wrong?

Thanks

Marco
Chris Taylor - 01 Apr 2007 17:30 GMT
Hi,

After setting the thread culture you will need to re-apply the resources to
the controls on the form. To get you started a routine like the following
should work. Please note that this does not catter to the more complex
scenarios where you might have child forms etc. This is just to get you
started.

   public void ApplyResources()
   {
     ComponentResourceManager resources = new
ComponentResourceManager(typeof(Form1));
     resources.ApplyResources(this, "$this");
     ApplyResources(this, resources);
   }

   public void ApplyResources(Control control, ComponentResourceManager
resources)
   {
     foreach (Control child in control.Controls)
     {
       resources.ApplyResources(child, child.Name);
       if (control.HasChildren) ApplyResources(child, resources);
     }
   }

   private void rbDefault_CheckedChanged(object sender, EventArgs e)
   {
     System.Threading.Thread.CurrentThread.CurrentUICulture = new
CultureInfo("en");
     ApplyResources();
   }

   private void rbAfrikaans_CheckedChanged(object sender, EventArgs e)
   {
     System.Threading.Thread.CurrentThread.CurrentUICulture = new
CultureInfo("af");
     ApplyResources();
   }

Hope this helps

Signature

Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor

> Hi to all!,
>
[quoted text clipped - 14 lines]
>
> Marco

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.