Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Waitable Timers in VB.NET

28 views
Skip to first unread message

Mike

unread,
Mar 20, 2006, 9:22:40 AM3/20/06
to
Hello everyone:
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.

Mike

unread,
Mar 20, 2006, 9:22:39 AM3/20/06
to

Chris

unread,
Mar 20, 2006, 10:53:54 AM3/20/06
to

The timer object does basically the same thing. You can have it fire
every five seconds (turn it off during your processing cycle) and the
application will still respond to events.

Chris

Mike

unread,
Mar 20, 2006, 11:08:13 AM3/20/06
to
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.

0 new messages