473,498 Members | 703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

loading strings

Hello,

Got strings.resx included in my assmebly as the default language neutral
collection.

ResourceManager res=new ResourceManager("strings",
Assembly.GetExecutingAssembly());

string test=res.GetString("TestString");

TestString exists in the resource file. The compiler message window
seems to indicate thsat the strings are compiled and included in the
assembly but I'm getting unhandled exception
System.Resources.MissingManifestResourceException

Could not find any resources appropriate for the specified culture in
the given assembly. Make sure "strings.resources" was correctly linked
or embedded into assembly.

Help!!!
Nov 17 '05 #1
4 2129
You need to use the fully qualified name of the resource file in the
ResourceManager constructor.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"Phil Da Lick!" <ph***********@NOSPAMhotmail.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
Hello,

Got strings.resx included in my assmebly as the default language neutral
collection.

ResourceManager res=new ResourceManager("strings",
Assembly.GetExecutingAssembly());

string test=res.GetString("TestString");

TestString exists in the resource file. The compiler message window seems
to indicate thsat the strings are compiled and included in the assembly
but I'm getting unhandled exception
System.Resources.MissingManifestResourceException

Could not find any resources appropriate for the specified culture in the
given assembly. Make sure "strings.resources" was correctly linked or
embedded into assembly.

Help!!!

Nov 17 '05 #2
Kai Brinkmann [MSFT] wrote:
You need to use the fully qualified name of the resource file in the
ResourceManager constructor.


what resource file? does it not work the same way as VC++ where the
resources are compiled into the assembly? I've just added the resources
in a resx to the assembly in the prroject view.
Nov 17 '05 #3
Yes, the base resources are compiled into the assembly. All language
resource files end up in satellite assemblies. If you're using VS, this will
be done automatically as long as you observe the proper naming conventions.

For example, let's assume you created a resource file AppResources.resx in
your project and your namespace is MyNamespace.MyApp.
In this case, the ctor for your ResourceManager should look like this:

ResourceManager rm = new ResourceManager("MyNamespace.MyApp.AppResources",
Assembly.GetExecutingAssembly());

Note the fully qualified resource name!

AppResources.resx is compiled to AppResources.resources (you can do this
manually using resgen) and embedded in your core assembly (MyApp.exe). You
can create localized resource files like this:

AppResources.fr-FR.resx // French (France) resources
AppResources.de-DE.resx // German (Germany) resources
AppResources.ja-JP.resx // Japanese (Japan) resources

These resources will also be compiled to their appropriate resources files
and embedded in satellite assemblies named MyApp.resources.dll. These
assemblies will end up in directories named after the culture (fr-FR, de-DE,
ja-JP) underneath your main application directory. At run-time, the resource
manager will attempt to find appropriate resources for the selected
CurrentUICulture. There is a fallback mechanism if no resources can be
found, and as a last resort the resources embedded in the main assembly will
be used (i.e. the resources in the base resource file AppResources.resx).

I hope this helps.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"Phil Da Lick!" <ph***********@NOSPAMhotmail.com> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
Kai Brinkmann [MSFT] wrote:
You need to use the fully qualified name of the resource file in the
ResourceManager constructor.


what resource file? does it not work the same way as VC++ where the
resources are compiled into the assembly? I've just added the resources in
a resx to the assembly in the prroject view.

Nov 17 '05 #4
Kai Brinkmann [MSFT] wrote:
Yes, the base resources are compiled into the assembly. All language
resource files end up in satellite assemblies. If you're using VS, this will
be done automatically as long as you observe the proper naming conventions.

For example, let's assume you created a resource file AppResources.resx in
your project and your namespace is MyNamespace.MyApp.
In this case, the ctor for your ResourceManager should look like this:

ResourceManager rm = new ResourceManager("MyNamespace.MyApp.AppResources",
Assembly.GetExecutingAssembly());

Note the fully qualified resource name!
Just what I needed, thanks.

AppResources.resx is compiled to AppResources.resources (you can do this
manually using resgen) and embedded in your core assembly (MyApp.exe). You
can create localized resource files like this:

AppResources.fr-FR.resx // French (France) resources
AppResources.de-DE.resx // German (Germany) resources
AppResources.ja-JP.resx // Japanese (Japan) resources


So can I also just include these into the assembly in the project view
and VS will take care of them automatically?
Nov 17 '05 #5

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

Similar topics

0
1073
by: Lady_A | last post by:
Hi, I have an XP SP2, .net framework 1.1 SP1. An html/css interface using jscripts in which I create ActiveX objects and present a dialog using the appropriate language set by the user on that...
7
1554
by: Tim | last post by:
I am trying to load both server and user controls into placeholder controls on a aspx template page at runtime. These values would be strings that are returned from a database query. I know I can...
1
1381
by: John | last post by:
Howdie I got two issues. The file I load into a listbox, contain alot of strange characters. How should I load the file so the characters remain in shape as they have been as when opened in...
1
1487
by: bobmct | last post by:
Fellow PHP'ers; I'm digging myself a hole on this one so I thought it has come to the time when I must ask those who know. I have what should be a simple question for loading, accessing and...
7
10109
by: greywire | last post by:
So I need to load lots of data into my database. So I discover LOAD DATA INFILE. Great! This little gem loads my CSV in blazing times (compared to parsing the file and doing INSERT for each...
0
1875
by: John Allman | last post by:
Hi all, I'm trying to create a setup which allows a program to request an object using strings and get an object of that type. It appears to be mostly working but i have difficulties if i...
7
1782
by: koonda | last post by:
Hi guys, I am trying to create a web interface in C# using ASP.NET. The database being used is SQL Server. I have some problems loading the tables in the datalist controls. When I run the program...
1
1795
by: Nader | last post by:
I have the next simple code and it doesn't work: ResourceManager gStrings = new ResourceManager("MyApp.Strings", Assembly.GetExecutingAssembly()); //Get the user's language. CultureInfo ci =...
9
1705
by: igor.tatarinov | last post by:
Hi, I am pretty new to Python and trying to use it for a relatively simple problem of loading a 5 million line text file and converting it into a few binary files. The text file has a fixed format...
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.