tags:

views:

132

answers:

2

I have a series of controls, but mostly textboxes and labels that need to be properly globalized. Is there an easy to way to bind them to the appropriate resource file like there is in ASP.Net?

A: 

You should be able to make use of the TextBox's DataBindings Property. It's a collection so you call it something like this:

this.textBox1.DataBindings.Add("Text",myResourceFile,"MyResourceFileProperty");

Not exactly, but you get the idea.

See here

BFree
+1  A: 

VS.NET will handle this automatically for you.

Select the form/usercontrol that is the host and set the Localizable property to true. Then, set the Language property to the language you wish to set the properties on the form for (in this case, you want Text, but you can change other details for different locales as well).

Set all the properties for the locale in the appropriate language.

Go and switch the language, and repeat.

You can't add more controls when the Language is not Default, so just set it back to Default, add your controls, and then switch to another language if you need to.

casperOne