Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5942907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:19:10+00:00 2026-05-22T16:19:10+00:00

I have a program in which I want to pass multiple tasks to a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:19:11+00:00Added an answer on May 22, 2026 at 4:19 pm

    You have to create BackgroundWorker programmatically:

    for (int i = 0; i < cnt; i++)
            {
                string sDiv = dlg.GetItem(i).Substring(0, 5);
                var bgw = new BackGroundWorker();
                // some kind of wait or delay or test needed here
                bgw.DoWork += 
                new DoWorkEventHandler(bw_DoWork);
                bgw.ProgressChanged += 
                new ProgressChangedEventHandler(bw_ProgressChanged);
                bgw.RunWorkerCompleted += 
                new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
                bgw.RunWorkerAsync(sDiv);
            }  
    

    Another option is to wait until your bgw8Div is completed. You can find more info at How to wait for a BackgroundWorker to cancel?. Of course, you’ll lose the multi-threading features this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that is been implemented in C++ which I now want
I have a program which i have myself written in java, but I want
I have two strings in a java program, which I want to mix in
I have a command line program, which outputs logging to the screen. I want
i have written a c program to which i pass in a script like
I have the following problem with a program which I wrote in Visual C++
I got a weird problem. I have a program that (does many things but
I have a program which needs to behave slightly differently on Tiger than on
I have a program which deliberately performs a divide by zero (and stores the
I have a program which has some Textareas / Labels these can be anywhere

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.