I’m completely confused about the event handling. I read some articles about it but after it I just get confused to write and use them in my classes.
This is my class i. e.:
Public Class Test
Public Event playedEvent()
Public Sub playTimer()
RaiseEvent playedEvent()
End Sub
End Class
Usage:
Friend WithEvents t as Test
Private Sub AnEvent() Handles t.playedEvent()
'Do some stuff
End Sub
I dont have any argument passing. But I want to know how should I do it too. And I wanted to know if each instance of the Test class, run this event separately I mean each instance by themselves, This event AnEvent() will occur? Cuz I have lots of instances from my class.
Thanks.
Every instance of class
Testwill have it’s own event and you can handle them separately. If you e.g. want to add the instance ofTestas parameter to the event, you have to change the event declaration in the following way:Then you can raise it:
and handle it:
Here are more informations: http://msdn.microsoft.com/en-us/library/wkzf914z.aspx