Determine if an event has been attached to yet

前端 未结 4 1134
悲哀的现实
悲哀的现实 2021-01-12 07:12

I have two objects - one that contains some code with will fire an event, and one that contains the handler for that event. I can\'t \"AddHandler\" in the Load of the first

4条回答
  •  一生所求
    2021-01-12 07:46

    You could also just have a bool field that you check before hooking the event.

    if not eventHooked then
     addhandler
     eventHooked = true
    end if
    

    Also if you need a good c# to vb converter http://www.tangiblesoftwaresolutions.com/ has one that can translate a 100 lines on the fly or less for or translate a project of a 1000 lines for free. More than that you have to purchase it, but that usually those limits will work just fine. No I am not trying to advertise for them :-)

提交回复
热议问题