|
-
Aug 28th, 2006, 02:01 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] Interrupt sleep
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!
-
Aug 28th, 2006, 02:19 PM
#2
Re: [2005] Interrupt sleep
Use the .Interrupt()
method but it only applies to threads in the WaitSleepJoin thread state.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 28th, 2006, 02:24 PM
#3
Hyperactive Member
Re: [2005] Interrupt sleep
Use a loop
VB Code:
Do while checkbox.checked = true
threading.thread.sleep(250)
application.doevents()
loop
Last edited by PENNYSTOCK; Aug 28th, 2006 at 02:29 PM.
Visual Studio .NET 2005/.NET Framework 2.0
-
Aug 28th, 2006, 02:28 PM
#4
Hyperactive Member
Re: [2005] Interrupt sleep
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.
Visual Studio .NET 2005/.NET Framework 2.0
-
Aug 29th, 2006, 03:45 PM
#5
Thread Starter
Fanatic Member
Re: [2005] Interrupt sleep
I may look into the timer option. Thanks for the replies guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|