Event is a mechanism by which method of one class can raise method of another class, without the hazard of instantiating that class.Follow the below steps to add a event
- Define an event .
- Define a method.
- Link event and method and convert the method into event-handler method.
- Create a triggering method which will raise the event.
- Use set handler and register event handler method to a particular instance in the program.
Use below syntax to register a event handler method for a instance
for . "here instance is the object created by using create object
In the next we will be learning it with working example.