Click here to Skip to main content
16,022,205 members

Comments by Ramya 2010 (Top 22 by date)

Ramya 2010 26-Nov-10 0:26am View    
Deleted
Let us consider im having an application named as AAA.

Now Im Loading an assembly named as BBB.The aseembly BBB is having the declaration of event and delegate.

The handler to the event in BBB is available in AAA.

while loading the assembly BBB, i need to add the handler for the event in AAA.
Whenever the event occur in BBB, i should execute the handler method in AAA.

How to accomplish this..........?

i coded like dis in AAA
<pre>Assembly tstComponent = Assembly.LoadFile(BBB);
Type Global = tstComponent.GetType(ClassInBBB, false, true);

if (Global != null)
{

EventInfo l_objevent = Global.GetEvent("OnGetdelInBBB");
Type l_objEveType = l_objevent.EventHandlerType;
Type Dis = Assembly.GetExecutingAssembly().GetType("AAA", false, true);
MethodInfo l_method = Dis.GetMethod("HandlerinAAA");
Delegate d = Delegate.CreateDelegate(l_objEveType, l_method);//Getting argument bind exception in this line
MethodInfo addHandler = l_objevent.GetAddMethod();
Object[] addHandlerArgs = { d };
addHandler.Invoke(Dis, addHandlerArgs);

} </pre>
please help me. Thanks in advance
Ramya 2010 26-Nov-10 0:24am View    
Deleted
Let us consider im having an application named as AAA.
Now Im Loading an assembly named as BBB.The aseembly BBB is having the declaration of event and delegate.
The handler to the event in BBB is available in AAA.
while loading the assembly BBB, i need to add the handler for the event in AAA.
Whenever the event occur in BBB, i should execute the handler method in AAA.
How to accomplish this..........?

i coded like dis in AAA
Assembly tstComponent = Assembly.LoadFile(BBB);
Type Global = tstComponent.GetType(ClassInBBB, false, true);

if (Global != null)
{

EventInfo l_objevent = Global.GetEvent("OnGetdelInBBB");
Type l_objEveType = l_objevent.EventHandlerType;
Type Dis = Assembly.GetExecutingAssembly().GetType("AAA", false, true);
MethodInfo l_method = Dis.GetMethod("HandlerinAAA");
Delegate d = Delegate.CreateDelegate(l_objEveType, l_method);//Getting argument bind exception in this line
MethodInfo addHandler = l_objevent.GetAddMethod();
Object[] addHandlerArgs = { d };
addHandler.Invoke(Dis, addHandlerArgs);

}
please help me. Thanks in advance
Ramya 2010 25-Nov-10 3:58am View    
Thank You soo much......
Ramya 2010 25-Nov-10 2:19am View    
This is not what im expecting. let us consider my application is having
struct student
{
string name;
int age;
string grade;
float average;
}
dis structure type is not available in the loaded assembly.But i have to fill in that loaded assembly. how to do this?Is it possible?
Ramya 2010 24-Sep-10 2:43am View    
I just need some nice article to know about it......