When adding png image to button, 'System.Resources.MissingManifestResourceException' occurs

R

Ryan Taylor

Hello, I have an application where a lot of my buttons require images. I
have been using png images. Most of my forms work with images, however, I
have one particular form that does not work whenever a button has an image.
The following is the line of code I receive the image on.

this.button1.Image =
((System.Drawing.Image)(resources.GetObject("button1.Image")));


This is the error message.

An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the
specified culture (or the neutral culture) in the given assembly. Make sure
"MainWindow.resources" was correctly embedded or linked into assembly "cc".
baseName: MainWindow locationInfo: cc.MainWindow resource file name:
MainWindow.resources assembly: cc, Version=1.0.1887.29266, Culture=neutral,
PublicKeyToken=null

I have no idea why this particular form does not work when images are added
to the buttons. Any clues?
Thanks in advance.
 
R

Ryan Taylor

Man, I found the problem. It seems to be a bug. Maybe someone can confirm
this.
I had an enumeration defined within my namespace but before the form class,
when I moved the enumeration to be defined after the form class, the
application works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top