foreach (string file in listToConvert)
{
BackgroundWorker backgroundWorker = new BackgroundWorker();
backgroundWorker.WorkerReportsProgress = true;
backgroundWorker.DoWork += new DoWorkEventHandler(
(s3, e3) =>
{
newFile = sendFilesToConvert(file);
});
backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(
(s3, e3) =>
{
listBoxFiles.Items.Add(newFile);
});
backgroundWorker.RunWorkerAsync();
}
each file from the list will convert to another and i want that each BackgroundWorker will wait untill it's finish to convert and only then the next BackgroundWorker will start how can i do it ?