472,961 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

VS .NET 2005 Global Resources

Hello,
I'm working on a large solution, comprised on numerous Projects, and I
would like to have one central projects that contains a set of global
RESX Resources. It doesn't make sense to have various resources
(strings, images, etc...) scattered through the application; having
them all in one central area will be a huge boon.

The problem that I'm running into is being able to access these
resources from external assemblies. I have created a
"CompanyResources" Assembly, that contains a Resources.resx with all my
resources. Code is then automatically generated for this, and placed
in a Resources.Designer.cs file. For classes residing in my
CompanyResources assembly, I have strongly typed access to the
resources. For example, if I have an image titled "MATERIAL_REACTANT",
I can access this image from within the resources assembly with:

Properties.Resources.MATERIAL_REACTANT;

Unfortunately, I cannot get strongly typed access to these resources
from classes outside of the resources assembly.

If I examine the autogenerated code in Resources.Designer.cs, I see
that the class and all resource properties are "internal":

internal class Resources {
...
internal static System.Drawing.Bitmap MATERIAL_REACTANT
....
}

Obviously there is no way of accessing these properties from outside of
the assembly, when things are internal. Is there a way to get around
this?

I did find a way to access these resources from other assemblies by
doing the following:

private System.Resources.ResourceManager resources_ = new
System.Resources.ResourceManager("CompanyResources .Properties.Resources",
System.Reflection.Assembly.Load("CompanyResources" ));
The downside of doing this is that I lose strongly typed access (and
intellisense) to the resources. So instead of:
resources_.MATERIAL_REACTANT

I have to do:
resources_.GetObject("MATERIAL_REACTANT");
It seems that there must be some way around this. Clearly one of the
benefits of .NET Resources is being able to have strongly typed access,
and it would seem that having one global location for all resources
should be possible.

Any suggestions?

Thanks,
Spencer Miles

Feb 17 '06 #1
1 3166
Figured out a solution...

See:
http://forums.microsoft.com/MSDN/Sho...45329&SiteID=1

Feb 17 '06 #2

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

Similar topics

2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.