Hello,
Here is a way to do it:
Create a new class AbortableWorker
Imports System.ComponentModel
Imports System.Threading
Public Class AbortableBackgroundWorker
Inherits BackgroundWorker
Private _workerThread As Thread
Protected Overrides Sub OnDoWork(e As DoWorkEventArgs)
_workerThread = Thread.CurrentThread
Try
MyBase.OnDoWork(e)
Catch generatedExceptionName As ThreadAbortException
e.Cancel = True
Thread.ResetAbort()
End Try
End Sub
Public Sub Abort()
If _workerThread IsNot Nothing Then
_workerThread.Abort()
_workerThread = Nothing
End If
End Sub
End Class
to abort the worker:
AbortableBackgroundWorker1.Abort()
AbortableBackgroundWorker1.Dispose()
you can read about it here:
http://stackoverflow.com/questions/800767/how-to-kill-background-worker-completely[
^]
Valery.