Reputation: 133
I want to execute a function of an object when my application crashes. I have this third party library TMCTL
which I am using in one of my form Main
. This library is used to communicate with another windows application. Whenever my application is closed, its .Finish(CommID)
method has to be executed. I have put this method in form's closing
event. But sometimes, my application crashes due to unknown reasons. At that time this function doesn't get executed. This creates problem, when application is restarted.
I want to know is there any other way to execute this function apart from closing
event. I tried using UnhandledException
event in ApplicationEvents.vb
. But I am not sure how to call TMCTL
object in ApplicationEvents.vb
from my form. I have declared it as Public
in my form's code (Public cTmctl As TMCTL
). It gives error if I try to call using Main.cTmctl
in ApplicationEvents.vb
Upvotes: 2
Views: 171
Reputation: 51711
I don't think can be done this way, and if someone does come up with something I wouldn't trust it.
There are a couple of ways you could do this.
or
The second approach is helpful if you want the session to time out after some period of inactivity.
Upvotes: 1