Adding an event handler
Posted on 2006-06-12
I have a form and a class.
The class has a event that i want to monitor.
The form displays information based on events from this class.
Hence i want the form to loaded before the class is so I can monitor all the events and dont miss any on startup.
My question is can I add an event handler before the class is instantiated.
Private WithEvents myClass as SomeClass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler myClass.SomeEvent, addressOf SomeFunction
myClass = new SomeClass
Are there any associated problems that might occur with this?