This code sample creates a time and starts it in a new thread. To disable the thread we use the same timer as shown in the example.
'To create the timer for the threading part Public KeepAliveDelegate As Threading.TimerCallback Public KeepAliveTimer As System.Threading.Timer 'end
KeepAliveDelegate = AddressOf KeepAliveTimerHandler
'To start the threading timer. KeepAliveTimer = New System.Threading.Timer(KeepAliveDelegate, Nothing, 100, 100) KeepAliveTimer.Change(100, 100)
Private Sub KeepAliveTimerHandler(ByVal state As Object) 'Add code to run until the thread is stoped End sub
'To stop the thread or to disable the thread KeepAliveTimer.Change(0, System.Threading.Timeout.Infinite)
'to restrat the thread again using the below code KeepAliveTimer = New System.Threading.Timer(KeepAliveDelegate, Nothing, 0, 100)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|