?
Solved

get Root Namespace programatically

Posted on 2009-06-29
2
Medium Priority
?
426 Views
Last Modified: 2012-05-07
How can I get the Root Namespace programatically of my assembly?

I'm trying to use a Resource Manager object to get localized string from a resource file, but I have to specify the root namespace in the constructor of the Resource manager.  
0
Comment
Question by:OFGemini
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
abel earned 2000 total points
ID: 24737463
I assume you mean "root type" or "root assembly". The resource manager does not need a reference to the root namespace, instead, it needs a reference to a Type that it can use to locate the *.resources file inside the loaded assembly. In other words, it depends on what typename you used to "bind" the resource to the type and that Type is the one you should use in the constructor.

However, if you have a Resources.resx file in your WinForms application, it is actually much easier to let Visual Studio take care of everything for you. Simply use the following statement to get something from your resources:

Bitmap myPicture = Properties.Resources.MyPicture1;
Or use the following to get the ResourceManager that is currently associated to your default resources:

ResourceManager resMgr = Properties.Resources.ResourceManager;
-- Abel --

0

Featured Post

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question