Resource problems

  • Thread starter Thread starter Adam J. Rosen
  • Start date Start date
A

Adam J. Rosen

Hi all,

I am writing a winforms application, and whenever I set the icon for the
main form, I get the following exception message (A
MissingManifestResourceException) on running it:

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

I don't understand what is going on here. The .resx file has a base64
encoding for this.icon. As far as I can remember, i havn't changed any
culture settings. Does anyone know what the problem is here?

As a note, this is the app.ico file that VStudio generates in a new project.

Thanks for the help

Adam
 
Hi Adam,
Is it only when you try to set the icon? It is just a wild shot, but the
same exception is thrown when you have something declared before the form
(or custom control) class in the source file. The first thing declared in
the source file containing form or custom control has to be the form ot
custom control class itself. If you have other things at the begining of the
file move them at the end.

HTH
B\rgds
100
 
Well, I don't understand why it worked, but it did. Thanks for the help! I
just don't see why form code needs to be first in the file - any articles
you know of explaining this?

Adam
 
No, I don't know any articles. Designer names the resource file after the
first thing in the source file. Hence, the form cannot load the resources, I
believe. It might be not an issue when MS introduces the concept of "partial
types" in the next version of C#. Then they will keep designer generated
code in separate files so hopefully it will kind of sort the problem.

B\rgds
100
 
Back
Top