button images

S

Stephan Steiner

Hi

I have a 16x16 icon that I've set to be an embedded resource. I have also
added the icon as button image for one of my buttons. It compiles just fine,
but when I get the this line in InitializeComponent

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

I get an 'System.Resources.MissingManifestResourceException' exception. The
same thing happens if I set the build action of the icon to content.

I have no trouble accessing the icon and assigning it to the bitmap in code,
but why does VS allow me to assign the icon to the image and shows it
properly in the preview, then bombs out with that exception when I try to
run the application? And what can I do to fix that?

Regards
Stephan
 
H

Herfried K. Wagner [MVP]

Stephan Steiner said:
I have a 16x16 icon that I've set to be an embedded resource. I have also
added the icon as button image for one of my buttons. It compiles just
fine, but when I get the this line in InitializeComponent

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

I get an 'System.Resources.MissingManifestResourceException' exception.
The same thing happens if I set the build action of the icon to content.

Are you using a manifest file with "devenv.exe" to enable visual styles
inside the IDE? If this is the case delete the manifest file and recreate
the form.
 

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