1
votes

I've a problem with my form, it generates an error. If I delete them, it works fine but the problem becomes a bit buggy.

this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")))
this.pictureBox1.Image = ((System.Drawing.Image)
    (resources.GetObject("pictureBox1.Image")));
System.ComponentModel.ComponentResourceManager resources = 
    new System.ComponentModel.ComponentResourceManager(typeof(LYNXAntiCheatForm));

Error msg:

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. Make sure "LYNXAntiCheat.LYNXAntiCheatForm.resources" was correctly embedded or linked into assembly "LYNXAntiCheatForm" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Question:

How do I really solve this problem without having to delete those three lines of code. I did try to add a resx file called "LYNXAntiCheat"

I use Visual Studio 2012 Express to compile this C# project.

2
Use the designer to set the form's Icon and pictureBox1's Image property again.Hans Passant

2 Answers

7
votes

I had the same error on the this.Icon line because I put another class before my form's partial class in the CS file. I often do this while testing a new abstraction and just forget that you're not allowed to do that.

If you've got more than one class in a file with a Form, move that class to the end of the file or to another file entirely.

2
votes

You use your code in order as you write in example?

Because you must initialize resources before first use.
Try write last row before first two.

If you open form "Solution Explorer" tree, you see under your form resx file?
Like in this example for "BugReport.cs" form I see "BugReport.resx":

enter image description here

If yes, then your maybe deleted icon file from your resource file. If your resx file is there, you need open it (doubleclick from Solution Explorer) and check if "Icons" part of your resource file contains $this.Icon. And if "Images" part of your resource file contains pictureBox1.Image. If not, then you can add this resources manualy and rename it to this names.