Search code examples
vb.netvisual-studio-2012resourcesembedded-resource

VB.NET Adding an image so that it shows up under My.Resources.TheImageName


Using VS2012, I would like to add an image to the My.Resources. namespace. I would like to draw this image to a PictureBox on the Paint event.

I did the following:

I clicked "Add existing item", then I opened up the image. I clicked the image from the Solution Explorer and set the Build Task to "Embedded Resource".

I saved the project and re-built it. But it still does not show up under My.Resources.

What did I do wrong, please?

Thank you for the help!

ps:

I do not want to add it directly to "Resources.resx" (for example by clicking the "BackGroundImage" property of a form). I would prefer having the image in the solution explorer instead. I once experienced that VS2012 once damaged a file, and I had to rebuild the resource file. I would like to avoid it.


Solution

  • You need to add the image to the Resources tab in Project Properties, not to the project directly.