The following is an example that uses the Timer class in the System.Threading namespace to call back a given procedure. After the timer is running, you can change timer values only by means of a Change method, which takes only two arguments, the due time and the period. The Timer object has no Stop method. You stop the timer by calling its Dispose method.
Imports System.Threading Dim dueTime as New TimeSpan(0,0,1) Dim period as New TimeSpan(0,0,0,0,500) Dim t As New Timer(AddressOf TimerProc, Nothing, dueTime, period) Dim tEn As Boolean = True Private Sub TimerProc(ByVal state As Object) If tEn = True Then 'Do timer things End If End Sub
No comments:
Post a Comment
Comments are moderated and don't be surprised if your comment does not appear promptly.