Search code examples
visual-studio-2010dialogdesignerresx

How to point VS 2010 WinForm Designer to a different Resource File for selecting images?


In the Visual Studio 2010 Forms Designer, you can assign an image from a resource file to various WinForm controls by clicking on the Image property for the control. A "Select Resource" dialog box will show that looks like this:

Resource Dialog Box

In the image above, note that the Option for "Project resource file:" is selected and there is a DropDown list below it that shows "Properties\Resources.resx" along with a list of images that belongs to the Resources.resx file.

The DropDown list suggests that if I add multiple *.resx files to the project, that I can select the *.resx file, then select the image in that file. For example, this test project has 4 resource files:

  • Properties\Resources.resx
  • Properties\Resources1.resx
  • Properties\Resources2.resx
  • Properties\Resources3.resx

Solution

However, the dialog box never shows any of the other *.resx files in the project.

The file "Properties\Resources.resx" is the only *.resx file that is ever populated in the DropDown list, therefore I cannot select images from the other files using the WinForm designer.

Obviously, I can assign the images in code or pile all of the images into a single *.resx file, but I'm curious if anyone knows why the other resource files are not shown in the dialog box, or how to get Visual Studio to acknowledge the existence of the them ?

Thanks.


Solution

  • You added them to the wrong node, add them to the project root instead of the Properties node. It is automatic when you right-click the project, Add New Item, Resources File. You can fix it by dragging the .resx file. Drag it up and let go when you hover the project root node.