Im having an issue setting back my databackgroundw orker.is busy to
false. I call the CancelAsync() however it doesn;t cancel anything
with the backgroundworke r.
What else can I do. I can;t set the .Isbusy because its read-only
Public Sub StopAllDataBack groundThreads()
Me.tmrBackgroun dWorker.Enabled = False
Me.tmrBackgroun dWorker2.Enable d = False
If Not IsNothing(Me.da taBackgroundWor ker) Then
If dataBackgroundW orker.IsBusy Then
Me.dataBackgrou ndWorker.Cancel Async()
While dataBackgroundW orker.IsBusy
Application.DoE vents()
Me.dataBackgrou ndWorker.Cancel Async()
End While
Me.dataBackgrou ndWorker.Dispos e()
End If
End If
If Not IsNothing(Me.da taBackgroundWor ker2) Then
If dataBackgroundW orker2.IsBusy Then
Me.dataBackgrou ndWorker2.Cance lAsync()
While dataBackgroundW orker2.IsBusy
Application.DoE vents()
Me.dataBackgrou ndWorker2.Cance lAsync()
End While
Me.dataBackgrou ndWorker2.Dispo se()
End If
End If
End Sub
false. I call the CancelAsync() however it doesn;t cancel anything
with the backgroundworke r.
What else can I do. I can;t set the .Isbusy because its read-only
Public Sub StopAllDataBack groundThreads()
Me.tmrBackgroun dWorker.Enabled = False
Me.tmrBackgroun dWorker2.Enable d = False
If Not IsNothing(Me.da taBackgroundWor ker) Then
If dataBackgroundW orker.IsBusy Then
Me.dataBackgrou ndWorker.Cancel Async()
While dataBackgroundW orker.IsBusy
Application.DoE vents()
Me.dataBackgrou ndWorker.Cancel Async()
End While
Me.dataBackgrou ndWorker.Dispos e()
End If
End If
If Not IsNothing(Me.da taBackgroundWor ker2) Then
If dataBackgroundW orker2.IsBusy Then
Me.dataBackgrou ndWorker2.Cance lAsync()
While dataBackgroundW orker2.IsBusy
Application.DoE vents()
Me.dataBackgrou ndWorker2.Cance lAsync()
End While
Me.dataBackgrou ndWorker2.Dispo se()
End If
End If
End Sub
Comment