Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hy all,

How do I register an event using dll function. Then I can receive event from another created class.Easy story, register on the other class, implementation (eventhandler) on another class. Something like this

public void regEvent(nameofevent) //function inside dll
{
//register event here
}



From another class, created the event handler

public void nameofevent(object sender,EventArgs e) //inside app
{
// execute event
}
Posted
Updated 5-Dec-10 21:22pm
v3
Comments
sandipapatel 6-Dec-10 1:22am    
Not so clear.
What do you want to do? handle an event for a control or just func calls?
Try out : (sample is for a button)

Button1.Click += new EventHandler(EventHandlingMethodNameWithORWithoutParameters);

It will register the event for buttonclick dnamically and invokes it as per button clicks occur.
Pdaus 6-Dec-10 2:18am    
Actually, I want to register the event name trough external library and the event implementation on my application. I'm using management event watcher which is declare inside the dll. The purpose to register the event by sending the name of event. Any idea?
Toli Cuturicu 6-Dec-10 3:24am    
No question whatsoever.

1 solution

Events and Delegates simplified[^]

Try that Code Project Article, It helped me a lot when I was trying to allow events in a usercontrol be seen.

Good luck with your project
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900