Im only try to get a string...

S

Sam Martin

from a resource file.

Hi all,

Im having a bit of a moment.

I've got resource files in each of my assemblies, just named like
"Labels.resources" for example.

I've got a commond base method in one of my classes, that when given the
resource name = "Labels" and the Assembly i just want to get a string from
the resource file but keep getting:

_message "Could not find any resources appropriate for the specified
culture (or the neutral culture) in the given assembly. Make sure
\"Labels.resources\" was correctly embedded or linked into assembly
\"MyAsm.NameSpace\".\r\nbaseName: Labels locationInfo: <null> resource file
name: Labels.resources assembly: MyAsm, Version=1.0.1788.31693,
Culture=neutral, PublicKeyToken=null" string

the resources file is an embedding resource. Anyone got any ideas why?

TIA

Sam
 
B

Bob Powell [MVP]

The resources will probably be in a namespace. Most likely the root
namespace of the DLL or executable.

If you have an EXE called MyExe and the resources are called
Labels.MyLabelString then the fully qualified name for the string will be
"MyExe.LabelsMyLabelString"

As a sanity check you can write a little bit of code to dump out the
resource names before you do the final build. It lets you see all the names
in the assembly using the following code:

foreach(string s in this.GetType().Assembly.GetManifestResourceNames())
System.Diagnostics.Trace.WriteLine(s);

Whack this little bit of code in the form constructor somewhere and you'll
see all the fully qualified names in the assembly.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
S

Sam Martin

thanks bob, i actually sussed it out late last night, but you're code
snippet is very welcome.

thanks for the response / advice

sam
 

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