views:

632

answers:

1

I'm trying to add an image to the resource area of my application and not having very good luck. Is this broken in C# express?

I've tried:

  1. Add image to project using 'Add->Existing Item'. I have marked it as 'content', 'resource', and 'embedded resource' and nothing works.

here's the c# code:

ResourceManager oResource = new ResourceManager("MyApp.images", Assembly.GetExecutingAssembly());
oResource.IgnoreCase = true;
m_oBedState = (Bitmap)oResource.GetObject("MyImage.bmp");

I tried opening the resource1.resx file in the project and adding it there. Still can't find it.

Also, what's up with the auto created resource1.designer.cs?? Why do I need code here? I'm embedding a binary file in the resource area. It doesn't require more code bloat. I don't need "no steenkin' badges" ;)

A: 

When you add the resource it removes the file's extension. Your lookup has to match the name assigned exactly and without the extension it doesn't.

Jay