Hi,
I have my program sleeping with System.Threading.Thread.Sleep(1800000) which makes it pretty much just stop for 10 minutes. How can I interrupt this if needed though? And if I can't interrupt it, what's a better way to do this?
Thanks!
Printable View
Hi,
I have my program sleeping with System.Threading.Thread.Sleep(1800000) which makes it pretty much just stop for 10 minutes. How can I interrupt this if needed though? And if I can't interrupt it, what's a better way to do this?
Thanks!
Use the .Interrupt()
method but it only applies to threads in the WaitSleepJoin thread state.
Use a loop
VB Code:
Do while checkbox.checked = true threading.thread.sleep(250) application.doevents() loop
Why do you want it to sleep. If this is the main thread, then your app would will not respond at all. I'd use a timer if you want to do something every so often.
I may look into the timer option. Thanks for the replies guys.