NLS support for WinForm


I have a windows form based appln in c#. I want to provide NLS support. So in the gui designer I change the "language" property to reflect the lang i want and now i have the diff resource.dll in diff lang folders (fr, ru).
The problem is I want to add some string myself, like the error strings, but when i manually try to add to the .resx files and when i reopen the gui, or if i make any modfn to the gui, these strings disappear!

Any idea?
Who is Participating?
nachiketConnect With a Mentor Commented:
You can create your own Resource files are read from that

Goto Project properties and "Add New Item" from that choose "Assembly Resource File"

I created a new file called Resource1.resx Using VS.NET. In the data section added one member "Nachi"  and value as u like. and used below code for getting the string. After this is done only thing u need to do is to create many files for different culture of resource1.

IMP: remember your base name in ResourceManager constructor will be WindowsApplication1.Resource1 not only Resource1!!!

                  ResourceManager rm = new ResourceManager("WindowsApplication1.Resource1",Assembly.GetExecutingAssembly());
                  MessageBox.Show( rm.GetString("Nachi",System.Threading.Thread.CurrentThread.CurrentCulture));
Bob LearnedCommented:
These are some of the URLs that I have to help explain localization in C#:

Creating and Using Resources:

Using Resource-only Assemblies with C#:

The Mystery of Windows Resource Solved:

Generated Access to .NET Resource Strings:

kunjachan_Author Commented:
thnx for the urls. but none of them says how to add manually some strings into the .resx files created during the winform design.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.