Reputation: 607
I'm trying to kill a background worker in the .DoWork
event of the worker.
I was using:
backgroundworker.CancelAsync()
But it shows an error saying CancellationPending
does not allow
How can I kill a background worker after its work has completed its .DoWork
event?
Upvotes: 1
Views: 2232
Reputation: 1038890
You need to set the WorkerSupportsCancellation property to true
if you want to be able to send a cancellation request to the worker.
Upvotes: 2