Reputation: 12150
It is my first time to use resx file to store strings in Visual Studio. It's so weird that when I modified something on designer.cs, and saved it, all strings in resx were gone. Does anyone meet this issue before? How to solve it? Thanks!
Upvotes: 4
Views: 2058
Reputation: 21999
You should not edit Form.resx
files manually. Together with Form.Designer.cs
files they should only be edited with the use of winform designer.
Form.resx
and Form.locale.resx
files contains all resources associated with that form controls: icons, cursors, images, localization strings, etc.
If you need to put custom resources, then simply create separate resx-files (see here of how to work with them).
It is still a question, if you really need to use resource files. Having static
class to store strings is much more comfortable way, you will have all power of intellisence (find all references, no spelling errors, etc), while accessing resources required specifying identificator, where you can very easily make a mistake or two. If you think about localization, then it's different story (but still, you can use reflection and text-files to have it way more comfortable then microsoft satellite way).
Upvotes: 2
Reputation: 63203
Form.resx is only used by WinForms designer, so leave it alone in all cases.
The contents stored in such designer managed resource files can be,
ImageList
contentsLike @Kilazur pointed out, you should store your own resources in newly created resource files that are not controlled by the designer.
Upvotes: 0