Salve ragazzi,
avrei la necessita di eseguire un operazione in Background ogni Tot secondi. Allora io ho fatto cosi:
Il tutto funziona perfettamente, ma esegue le operazioni (EseguiOperazione) soltanto una volta. E' come se il Timer non ripartissecodice:Private Sub FrmTest_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Control.CheckForIllegalCrossThreadCalls = False TimerOperation.Interval = 3000 TimerOperation.Start() End Sub Private Sub TimerOperation_Tick(sender As System.Object, e As System.EventArgs) Handles TimerOperation.Tick If BackgroundWorker1.IsBusy = True Then Exit Sub End If BackgroundWorker1.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Call EseguiOperazione() End Sub Private Sub EseguiOperazione() TimerOperation.Stop() 'istruzioni TimerOperation.Start() End Sub

Rispondi quotando