473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Im only try to get a string...

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
Nov 16 '05 #1
2 1402
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.

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
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

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

thanks for the response / advice

sam

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
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


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site......
5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
9
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc.,...
10
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
2
by: Andrew | last post by:
I have written two classes : a String Class based on the book " C++ in 21 days " and a GenericIpClass listed below : file GenericStringClass.h // Generic String class
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
2
by: Badass Scotsman | last post by:
Hello, Using VB and ASP,NET I would like to be able to search a STRING for a smaller STRING within, based on the characters which appear before and after. For example: String1 = " That was...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no idea how. Any pointers much appreciated. Chris
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
8
by: drjay1627 | last post by:
hello, This is my 1st post here! *welcome drjay* Thanks! I look answering questions and getting answers to other! Now that we got that out of the way. I'm trying to read in a string and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.