currently, i have this code: My_BgWorkerB is the Name of my BackGround Worker
If My_BgWorkerB.IsBusy Then
If My_BgWorkerB.WorkerSupportsCancellation Then
My_BgWorkerB.CancelAsync()
End If
' in this part i want to know if the background worker is already stopped
' so that i can start it again
' My_BgWorkerB.RunWorkerAsync() ' => this should be triggered if the worker
' has already been stop.
Else
My_BgWorkerB.RunWorkerAsync()
End If
What you should do is check the
RunWorkerCompletedEventArgsCancelled property in your BGW’sRunWorkerCompletedevent handler. If it’s true restart your BGW using theRunWorkerAsync()method.Something like this: