2
Reply

Icons from resource name

Bill

Bill

Jul 15 2008 10:37 AM
9.4k
I'm trying to access image resources in my application, but I can't the resources from the application, I just end up with null. I've added the resources in the properties section in visual studio 2008, and the code I'm using is
private ResourceManager res = new ResourceManager("MyNameSpace.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());
Image myImage = (Image)res.GetObject("myImage.png");

But myImage is always null. I know I could use MyNameSpace.Properties.Resources.myImage.png, but I need to get the resource from a string.

Answers (2)