fishhead fishhead - 1 year ago 78
C# Question

How do I retrieve an image from my resx file?

I have added an image to my form's resource file, myForm.resx, and I would like to use it in my code file, myForm.cs, but I am not entirely clear on how to get a handle to it.

Answer Source

See MSDN for ResourceManager

rm = new ResourceManager("Images", this.GetType().Assembly); 
pictureBox1.Image = (System.Drawing.Image)rm.GetObject("flag");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download