Dear all,

I am trying to edit the .resx file (Form1.resx) so I can localize my application for different settings. However, when I edit my .resx file and then view it in Visual Studio, I get an error "ResX file Data at the root level is invalid. Line 1, position 1. cannot be parsed." If I open this file in an XML editor, I do not get any problems viewing the file. Any tips on how to solve this? Is there a limit of entries in the .resx file?

The Form1.resx file is used by visual studio to store resources for the form e.g. the background image.
Add another resource file for your own resource.
The easiest way to do this is to use the Resources tab on the Project properties.

Can you give an example of how you do that?

Currently I edit the .resx file by adding the following tags for a given translation:

<data name="Translation" xml:space="preserve">
<value>Translated text</value>
</data>

Then in the code, I reference Translation with a LocalRes.GetString command. However I do not think this is the best way to go for a solution, so if you have suggestions, please feel free to share.

It's never a good idea to change the .resx file since they are autogenerated.

Why do you want to do that, can you show us a code "used case".

If you need a good recommendation for what tool to use to manage the localization process of your .resx files, I endorse https://poeditor.com

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.