Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two classes, I Initialize Event handler in one class. and i need to listen this event handler from another class. In which way i can implement this ?

What I have tried:

I have already try,

public event EventHandler NetworkLostEvent;

i use this code to fire the event NetworkLostEvent(this, EventArgs.Empty);

How to listen this event from other class?
Posted
Updated 13-Jun-16 23:35pm

1 solution

All you have to do is add a handler to the class instance event.
Have a look at this: Transferring information between two forms, Part 2: Child to Parent[^] it demonstrates creating, firing, and handling an event from two classes (in this case forms but all classes work in identical ways)
 
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