Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error initializing form containing button with image

Status
Not open for further replies.

CaKiwi

Programmer
Apr 8, 2001
1,294
US
When I set the image field of a button on my form, I get the following error when my form is initializing.


A first chance 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 "Form1.resources" was correctly embedded or linked into assembly "test2".
baseName: Form1 locationInfo: test2.Form1 resource file name: Form1.resources assembly: test2, Version=1.0.2162.17278, Culture=neutral, PublicKeyToken=null


The statement being executed at the time is

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

Any help greatly appreciated.


CaKiwi
 
Click on the image in your project.

Under the properties - change "Build Type" to Embedded Resource.

Recompile and Redeploy
 
Hi JurkMonkey,

Thanks for the response.

Which image do I click on? I tried clicking and right-clicking the image on the form. Right-clicking brings up the properties window for the button but there is no "build type" field. I couldn't find anything useful clicking or right-clicking on the image in the properties window.

CaKiwi
 
Is your image in the "Solution Explorer"?

You would need to right click on it there.
 
Thanks. I will check on Monday and let you know.

Thanks again for the help

CaKiwi
 
I couldn't see a way of getting an existing image into the porject so I cretaed a new image file by clicking Project -> add new item -> BMP image, creating a file and then copying the bmp file I want onto the file just created. I then changed its build type property to Embedded Resource and linked. I still get the same fatal error.

Any further help greatly appreciated.

CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top