As the Remarks state, this trips the
CancellationPending flag which you need to check for periodically inside your
BackgroundWorker.DoWork() method.
Buried in the code example (http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker(VS.80).aspx), are the lines:
If worker.CancellationPending Then
e.Cancel = True
Else
I thought I'd point it out as I was checking for the CancellationPending flag and exiting my DoWork() method when it was True, then wondered why the e.Cancelled flag wasn't set when I checked it in the RunWorkerCompleted() event..
I hope this saves you some time :o)