Found the following interesting discussion in the Newsgroups:
| sleep by:Tony | |
| I want my program to sleep (do nothing) for one hour. I can use the timer and 3600 seconds and code around the midnight problem. is there a better way? I looked at datediff, hour, minute, second still have to worry about midnight. Thanks | |
| Reply: by:David Browne | |
How about this: Public Sub SleepUntil(ByVal untilWhen As DateTime) Dim wakeUp As TimeSpan = untilWhen.Subtract(Now) If TimeSpan.Compare(wakeUp, TimeSpan.Zero) = 1 Then System.Threading.Thread.Sleep(untilWhen.Subtract(Now())) End If End Sub David | |
| Reply: by:Herman Kheyfets | |
| System.Threading.CurrentThread.Sleep(New Timespan(1,0,0)) where 1 is one hour Gerasha | |
Posted by Xander Zelders

0 Comments:
Post a Comment
<< Home