I've written some code to handle an event as follows:
AddHandler myObject.myEvent, AddressOf myFunction
It seemed that everything was working at first, but when I ran the debugger, I discovered that oftentimes, myFunction
would run several times each time myObject.myEvent
fired. I figured out that I had allowed the code to add the event handler to run more than once, resulting in this behavior.
Is there a way I can do something like this?
If myObject.myEvent is not handled Then
AddHandler myObject.myEvent, AddressOf myFunction
End If