|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Waitable Timers in VB.NETI am looking for some VB.NET code samples that make use of waitable timers that put the thread of the application to Sleep for the specificied period of time. I am told that the benefit of using a Waitable timer to the Threading.thread.Sleep function is that the application will still be responsive to events, whereas Threading.thread.Sleep will just freeze the application for the set interval. I have some VB6 code and a waitable timer class that I could not make use of it in VB.NET. Example: 'This is an example for idling your application ' Private mobjWaitTimer As WaitTimer ' Private Sub RunProcess() ' Set mobjWaitTimer = New WaitTimer ' Do ' If mbWorkToDo Then ' Call ProcessWork() ' Else ' mobjWaitTimer.Wait(5000) 'Wait for 5 seconds ' End If ' Loop Until Not mbStop ' Set mobjWaitTimer = nothing ' End Sub I thank everyone that tried to offer me help. Mike wrote:
Show quoteHide quote > Hello everyone: The timer object does basically the same thing. You can have it fire > I am looking for some VB.NET code samples that make use of waitable > timers that put the thread of the application to Sleep for the > specificied period of time. I am told that the benefit of using a > Waitable timer to the Threading.thread.Sleep function is that the > application will still be responsive to events, whereas > Threading.thread.Sleep will just freeze the application for the set > interval. > > I have some VB6 code and a waitable timer class that I could not make > use of it in VB.NET. > > Example: 'This is an example for idling your application > > ' Private mobjWaitTimer As WaitTimer > ' Private Sub RunProcess() > ' Set mobjWaitTimer = New WaitTimer > ' Do > ' If mbWorkToDo Then > ' Call ProcessWork() > ' Else > ' mobjWaitTimer.Wait(5000) 'Wait for 5 seconds > ' End If > ' Loop Until Not mbStop > ' Set mobjWaitTimer = nothing > ' End Sub > > I thank everyone that tried to offer me help. > every five seconds (turn it off during your processing cycle) and the application will still respond to events. Chris Hello Chris,
Thank you for your reply. I thought about that. But, I already use more than four timers and many other components in the application. I was just wondering if I could do anything simillar to the WaitTimer API.. Please let me know if there is any other alternatives. Otherwise, I shall go with a timer. Thanks once again for your help. |
|||||||||||||||||||||||