Priscilla Jobin
Priscilla Jobin

Reputation: 607

How to kill a background worker in vb.net?

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

Answers (1)

Darin Dimitrov
Darin Dimitrov

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

Related Questions