I'm writing a small 2D engine that uses Lua to control it. I've been setting events up in between the Lua and the VB.net for the past little while here. The problem, I've realized, is that is that I can't seem to remove the events which is screwing up quite a few things (because they are being called when they should be done with). To fix this, I wanted to add some kind of way to remove the specific event handler.
I know how to add an event handler:
AddHandler Button1.Click, AddressOf Button1Clicked
But with this in mind, is their a way to remove a specific event handler in the VB.net?
Thanks!
EDIT
Sorry, I didn't explain this very well:
If I have this:
public sub setupevent(byval func as LuaFunction)
AddHandler Me.event_mouseup, Sub(x As Integer, y As Integer)
func.Call(x, y)
End Sub
end sub
(Somewhere else)
setupevent(someLuaFunction)
setupevent(someOtherLuaFunction)
setupevent(JustAnotherLuaFunction)
Is there a way to remove just one of these event connections on the fly?