Originally posted by leontager Hi, I have a sub called reconnect. How can I make my program run the sub and if after 20 seconds it wasnt finished close it?
You could run it in another thread. Then using a timer check to see if the thread is still running, and if it is terminate it and display a error message about not being able to reconnect.
Something like this:
Code:
Declare the thread
Dim objThread as System.Threading.Thread
Instantiate the thread with the starting function
objThread = New System.Threading.Thread(AddressOf Reconnect)
Start the thread
objThread.Start()
Then you can use the timer to check the status of the objThread object.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.