Hello All,
I am here with the same Query but with a different look
I want to apply the culture change to my program.
I created a class library for culture change. and applied it .
It is only working with the form name, i did it with two different languages and got the result.
But the controls inside the form remains as it is.
Please help.

Recommended Answers

All 4 Replies

Add a sub like

Sub ApplyCulture(Byval SelectedCulturename as String)
	Dim Rm As New Resources.ResourceManager("YourProject.YourFormClass", System.Reflection.Assembly.GetExecutingAssembly())
	Dim Ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(SelectedCultureName)
	Me.Text = Rm.GetString("$this.Text", Ci)
.
.	' you need to do this for all controls having a distinct text depending on the language
.
	Me.btnWhatItWas.Text = Rm.GetString("btnWhatItWas.Text", Ci)
.
.
.
End Sub

Then call this sub at the load event of the form. Also when you want to change the interface language.

Hope this helps

Thanks for your reply
But scenario is little bit different.
this code is not dynamic.
to make it dynamic I created a Class library
and inside that I did the things you mentioned and used a code to get the controls of form dynamically.
It works with perferctly in demo project I got from web.
but when i tried to make my own program, I did all those things related to culture exactly similar to the demo project.
The thing is My form title is changing.
but the controls text is not changing.

Dim fields As FieldInfo() = form.[GetType]().GetFields(BindingFlags.Instance Or BindingFlags.DeclaredOnly Or BindingFlags.NonPublic)

This code returns exact name of controls in demo project.

but in my program and underscore is prefixed like '_controlName'.

Did you already tryed:

For each C as Control In Form.Controls
'
'    Do here what you need for each control
'
Next

?

Hello lolafuertes,
Thank you for your reply.
it works.
Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.