473,408 Members | 2,839 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,408 software developers and data experts.

C# Problem, please help

Hi NG,

I have an interesting problem. I have written a simple AddIn-Framework where
I load Assemblies in with

Assembly.LoadFrom(...

Now I want to globalize the Plugins, so I have written a routine like this:

public Globalizator(Object obj)
{
this.obj = obj;
}

public void Translate(string baseName)
{
if (null == obj)
return ;

Type t = obj.GetType();
String str = t.FullName;
ResourceManager rm = new ResourceManager(baseName, t.Assembly);
// Instance properites.
PropertyInfo [] pi = t.GetProperties (BindingFlags.Instance |
BindingFlags.Public);

foreach (PropertyInfo p in pi)
{
try
{
string resName = t.FullName + '.' + p.Name;
Object resObj = rm.GetObject(resName);
if (resObj != null)
if (p.CanWrite)
t.GetProperty(p.Name).SetValue(obj, resObj, null);
}
catch (Exception e)
....

So, loading in the Plugin does not work! Has anybody an idea why?

Thank you

Rudi
Nov 15 '05 #1
2 3036
What exception are you getting? Could you please clarify your problem?

Greetz,
-- Rob.

Rudolf Ball wrote:
Hi NG,

I have an interesting problem. I have written a simple
AddIn-Framework where I load Assemblies in with

Assembly.LoadFrom(...

Now I want to globalize the Plugins, so I have written a routine like
this:

public Globalizator(Object obj)
{
this.obj = obj;
}

public void Translate(string baseName)
{
if (null == obj)
return ;

Type t = obj.GetType();
String str = t.FullName;
ResourceManager rm = new ResourceManager(baseName, t.Assembly);
// Instance properites.
PropertyInfo [] pi = t.GetProperties (BindingFlags.Instance |
BindingFlags.Public);

foreach (PropertyInfo p in pi)
{
try
{
string resName = t.FullName + '.' + p.Name;
Object resObj = rm.GetObject(resName);
if (resObj != null)
if (p.CanWrite)
t.GetProperty(p.Name).SetValue(obj, resObj, null);
}
catch (Exception e)
...

So, loading in the Plugin does not work! Has anybody an idea why?

Thank you

Rudi

Nov 15 '05 #2
Thanx,

i get following exception:

System.Reflection.TargetInvocationException

and

Exception has been thrown by the target of an invocation
"Rob Tillie" <Ro********@student.tul.edu> wrote in message
news:ur**************@TK2MSFTNGP12.phx.gbl...
What exception are you getting? Could you please clarify your problem?

Greetz,
-- Rob.

Rudolf Ball wrote:
Hi NG,

I have an interesting problem. I have written a simple
AddIn-Framework where I load Assemblies in with

Assembly.LoadFrom(...

Now I want to globalize the Plugins, so I have written a routine like
this:

public Globalizator(Object obj)
{
this.obj = obj;
}

public void Translate(string baseName)
{
if (null == obj)
return ;

Type t = obj.GetType();
String str = t.FullName;
ResourceManager rm = new ResourceManager(baseName, t.Assembly);
// Instance properites.
PropertyInfo [] pi = t.GetProperties (BindingFlags.Instance |
BindingFlags.Public);

foreach (PropertyInfo p in pi)
{
try
{
string resName = t.FullName + '.' + p.Name;
Object resObj = rm.GetObject(resName);
if (resObj != null)
if (p.CanWrite)
t.GetProperty(p.Name).SetValue(obj, resObj, null);
}
catch (Exception e)
...

So, loading in the Plugin does not work! Has anybody an idea why?

Thank you

Rudi


Nov 15 '05 #3

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

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
3
by: Spacy | last post by:
Am creating a HTML Report in asp.net. To save this report to excel on client-side, i write this code: Response.ContentType = "application/vnd.ms-excel" Response.AddHeader("content-disposition",...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
5
by: Hari | last post by:
Guys please help me to solve this strange problem what Iam getting as follows.. Trying to instantiate a global instance of a template class as follows :- when i build this code with debug and...
11
by: ASP newbie | last post by:
I cannot run my asp.net application in w2k server. But the program works fine under w2k professional. Can anyone tell me is there any difference in the settings? Many thanks.
1
by: funfair | last post by:
HI,EVERY ONE first problem, i have create a database in access 2003 it worked fine untill i have format my laptop . now im working on office 2003 on windows xp and i have norton 2006 but im...
2
by: cty0000 | last post by:
Please anybody help me... I have some serious problem.. I'm doing to keep equpiment list(string).. In my code, there are 3 page which are having 4 equpiment ID (user control.) like this...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.