I have a program in which I want to pass multiple tasks to a BackGroundWorker in sequence. My problem is that the RunWorkerCompleted event is not being executed and the IsBusy flag is not being cleared. The ProgressChanged event does execute. The final statement in the DoWork routine does get executed. I can do the first task, but not any subsequent tasks.
Any ideas what to look at?
Edit (code added):
The notion (somewhat simplified) is like this:
for (int i = 0; i < cnt; i++)
{
string sDiv = dlg.GetItem(i).Substring(0, 5);
bgw8Div.RunWorkerAsync(sDiv);
// some kind of wait or delay or test needed here
}
If cnt==1, all is well. If cnt>1, the RunWorkerCompleted event is never executed for case i==0 regardless of the wait or delay that I put in the loop.