Stopper le backgroungworker
Bonjour
j'essais de stopper le backgroungworker sans success
dans la form1
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Private WithEvents backgroundWorker1 As New System.ComponentModel.BackgroundWorker
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
backgroundWorker1.WorkerSupportsCancellation = True
backgroundWorker1.RunWorkerAsync()
end sub
Private Sub ToolStripnew_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ToolStripnew.MouseDown
If Not backgroundWorker1.IsBusy Then
backgroundWorker1.RunWorkerAsync()
Else
backgroundWorker1.CancelAsync()
End If
End Sub
Private Sub backgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles backgroundWorker1.DoWork
If Not backgroundWorker1.CancellationPending Then
listworddata = wordsolution.FindWords(Function() backgroundWorker1.CancellationPending)
else
?
End If
End Sub |