Vb.net – How to get Visual Studio to recognize multiple project resource files

vb.netvisual studiovisual studio 2010

I have a Windows project in Visual Studio 2010 in which I store all images in the project's resource file that Visual Studio created for me. However, it's getting cluttered and I'd like to separate images into multiple resource files if possible. I created a new resource file, but Visual Studio doesn't recognize it when I go to the form designer and try to change an image. The only file that comes up under the Project resource files available are MyProject\Resources.resx. The one that I just created isn't there.

Any idea why it doesn't show up? I tried putting the resource under the My.Resources namespace as well as change the namespace and I also made it public. It still doesn't show up.

Select Resource screen

Best Answer

A project only has a single default resource file. You can add additional non-default resource files to the project at any time. Additional resources files will NOT be placed in the "My Project" folder. They will simply be added to the project like other files are.

You can refer to these new resources the same way you refer to others. Instead of accessing the resources through "My.Resources.", you will find the other resource files under "My.Resources.[Resource File Name]".

EDIT: A resource file needs to be in the root of your project if you want to reference it from a PictureBox control.

I hope this helps you.