there is a method to cancel a BackgroundWorker:
doWorkAnuncios.CancelAsync();
and then you can do something if it was cancelled or not at the completed function:
private void doWorkAnuncios_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if ((e.Cancelled == true))
{
//do something if it was cancelled
}
else if (!(e.Error == null))
{
//when an error occur
}
else
{
//ended the background with no problems or cancel, just like you have
}
}