Globalization

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Globalization

 
0
  #1
Nov 11th, 2008
I have made two resource files,named

1)Form1.en-US.resx
Name Value
Button1.Text English


2)Form1.fr-FR.resx
Name Value
Button1.Text France

My Code is as Under-



  1. Imports System.Globalization
  2. Imports System.Threading
  3.  
  4. Public Class Form1
  5. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6. Dim ci As CultureInfo
  7. Dim aL As New ArrayList()
  8. For Each ci In CultureInfo.GetCultures(CultureTypes.SpecificCultures)
  9. ComboBox1.Items.Add(ci.Name)
  10. Next ci
  11. End Sub
  12.  
  13. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  14. Dim lang As String
  15. lang = ComboBox1.SelectedItem
  16.  
  17. Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang) 'Changes the Language
  18. End Sub
  19. End Class

But the Button1 text is not changing.Can Somebody tell where i m wrong?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Re: Globalization

 
0
  #2
Nov 11th, 2008
I have made two resource files,named Under the folder MyResources & mine project Name Language

1)myres.en-US.resx
Name Value
Button1.Text English


2)myres.fr-FR.resx
Name Value
Button1.Text France

My Code is as Under
  1. Imports System.Globalization
  2. Imports System.Threading
  3. Imports System.Resources
  4. Imports System.IO
  5. Imports System.Reflection
  6.  
  7. Public Class Form1
  8. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9. Dim ci As CultureInfo
  10. Dim aL As New ArrayList()
  11. For Each ci In CultureInfo.GetCultures(CultureTypes.SpecificCultures)
  12. ComboBox1.Items.Add(ci.Name)
  13. Next ci
  14. End Sub
  15.  
  16. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  17. Dim lang As String
  18. Dim rm As ResourceManager
  19. lang = ComboBox1.SelectedItem
  20.  
  21. ' Thread.CurrentThread.CurrentCulture = New CultureInfo(lang) 'Changes the Language
  22. Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang) 'Changes the Language
  23.  
  24. rm = New ResourceManager("Language.MyLocalResources.myRes", Assembly.GetExecutingAssembly())
  25. Button1.Text = rm.GetString("Button1.Text")
  26.  
  27. End Sub
  28. End Class


But the Button1 text is not changing.Insted Error is there--Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Lnaguage.MyLocalResources.myRes.resources" was correctly embedded .


Can Somebody help me!!!!!!!!!!!
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 65
Reputation: Renukavani is an unknown quantity at this point 
Solved Threads: 6
Renukavani Renukavani is offline Offline
Junior Poster in Training

Re: Globalization

 
0
  #3
Nov 11th, 2008
Originally Posted by sonia sardana View Post
I have made two resource files,named Under the folder MyResources & mine project Name Language

1)myres.en-US.resx
Name Value
Button1.Text English


2)myres.fr-FR.resx
Name Value
Button1.Text France

My Code is as Under
  1. Imports System.Globalization
  2. Imports System.Threading
  3. Imports System.Resources
  4. Imports System.IO
  5. Imports System.Reflection
  6.  
  7. Public Class Form1
  8. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9. Dim ci As CultureInfo
  10. Dim aL As New ArrayList()
  11. For Each ci In CultureInfo.GetCultures(CultureTypes.SpecificCultures)
  12. ComboBox1.Items.Add(ci.Name)
  13. Next ci
  14. End Sub
  15.  
  16. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  17. Dim lang As String
  18. Dim rm As ResourceManager
  19. lang = ComboBox1.SelectedItem
  20.  
  21. ' Thread.CurrentThread.CurrentCulture = New CultureInfo(lang) 'Changes the Language
  22. Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang) 'Changes the Language
  23.  
  24. rm = New ResourceManager("Language.MyLocalResources.myRes", Assembly.GetExecutingAssembly())
  25. Button1.Text = rm.GetString("Button1.Text")
  26.  
  27. End Sub
  28. End Class


But the Button1 text is not changing.Insted Error is there--Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Lnaguage.MyLocalResources.myRes.resources" was correctly embedded .


Can Somebody help me!!!!!!!!!!!

hi
actualy u r adding mulilang files into project under resources folder. u need add bin/debug/resources/ here u have to create the textfile.not resouces file
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Globalization

 
0
  #4
Nov 11th, 2008
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Re: Globalization

 
0
  #5
Nov 11th, 2008
THX I Solved it....SOLUTION--

  1. Imports System.Globalization
  2. Imports System.Threading
  3. Imports System.Resources
  4. Imports System.IO
  5. Imports System.Reflection
  6.  
  7. Public Class Form1
  8. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9. Dim ci As CultureInfo
  10. Dim aL As New ArrayList()
  11. For Each ci In CultureInfo.GetCultures(CultureTypes.SpecificCultures)
  12. ComboBox1.Items.Add(ci.Name)
  13. Next ci
  14. End Sub
  15.  
  16. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  17. Dim lang As String
  18. Dim rm As ResourceManager
  19. lang = ComboBox1.SelectedItem
  20.  
  21.  
  22. 'IIND
  23. Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang)
  24. rm = New ResourceManager("Lnaguage.Resource", Assembly.GetExecutingAssembly())
  25. Button1.Text = rm.GetString("Button1")
  26. End Sub
  27. End Class

Resource File Names-

Resource.en-US.resx
Resource.fr-FR.resx
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 4
Reputation: sourav bansal is an unknown quantity at this point 
Solved Threads: 0
sourav bansal sourav bansal is offline Offline
Newbie Poster

Re: Globalization

 
-1
  #6
Nov 12th, 2008
plz...send me this answer in vb.net 2005 version nd also give me passcode for vb.net 2005 ...plz do it soon..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC