Help with error message

G

Guest

Hello

I have this error message when i try to open a form
My coding falls over on this line....

Me.Button2.Image = CType(resources.GetObject("Button2.Image"), System.Drawing.Bitmap

Infact even when i comment out this line it falls over on the next line that refernences an image
Here is the error i am getting. does anyone know how to fix??....

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

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

I got some advise off someone previously but i do not know what they mean. Here is what they advised me to do...
"Make sure that the resource you're referencing (button2.image) is set as an
embedded resource in your solution


Any help is appreciated
 
W

William Ryan eMVP

Click on the properties tab of the image in question, then change the Build
Action property to Embedded Resource, it's probably set to Content right
now. Also, make sure you have its name correct and file extension. YOu can
also use
Reflection.Assembly.GetEntryAssembly.GetManifestResourceStream("SolumtionNam
e.ResourceName")

http://www.knowdotnet.com/articles/ddl.html

HTH,

Bill
Varun said:
Hello,

I have this error message when i try to open a form.
My coding falls over on this line.....

Me.Button2.Image = CType(resources.GetObject("Button2.Image"), System.Drawing.Bitmap)

Infact even when i comment out this line it falls over on the next line that refernences an image.
Here is the error i am getting. does anyone know how to fix??.....

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
"frmRes.resources" was correctly embedded or linked into assembly "MyProj".
baseName: frmRes locationInfo: MyProj.frmRes resource file name:
frmRes.resources assembly: MyProj, Version=1.0.1550.16863, Culture=neutral,
PublicKeyToken=null
I got some advise off someone previously but i do not know what they mean.
Here is what they advised me to do....
 
D

DotNetJunkies User

I know this thread is old but I had the same problem and I hit a bunch of boards to find the answer. I finally found the answer to my problem and thought I would share it.

Drum roll please.......The form class must be the first class defined in the form's .cs file. You can't have a helper class or enum defined before it.

More info at: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q318603

Peter Thomas
 

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