943,714 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 2872
  • VB.NET RSS
Nov 11th, 2008
0

Globalization

Expand Post »
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-



VB.NET Syntax (Toggle Plain Text)
  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?
Similar Threads
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Nov 11th, 2008
0

Re: Globalization

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
VB.NET Syntax (Toggle Plain Text)
  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!!!!!!!!!!!
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Nov 11th, 2008
0

Re: Globalization

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
VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 23
Junior Poster
Renukavani is offline Offline
123 posts
since Jul 2008
Nov 11th, 2008
0

Re: Globalization

Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Nov 11th, 2008
0

Re: Globalization

THX I Solved it....SOLUTION--

VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Nov 12th, 2008
-1

Re: Globalization

plz...send me this answer in vb.net 2005 version nd also give me passcode for vb.net 2005 ...plz do it soon..
Reputation Points: 7
Solved Threads: 0
Newbie Poster
sourav bansal is offline Offline
4 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: textchanged event help
Next Thread in VB.NET Forum Timeline: inserting text at cursor





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC