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 6879325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:49:55+00:00 2026-05-27T04:49:55+00:00

I have a loop in Background worker in a Winform Application. I Just used

  • 0

I have a loop in Background worker in a Winform Application.

I Just used this Code but it won’t resume after the Pause.

In the main Class I use this

System.Threading.ManualResetEvent _busy = new System.Threading.ManualResetEvent(false);

Then in My Start Click I wrote this:

      if (!backgroundWorker1.IsBusy)
            {
                MessageBox.Show("Not Busy"); //Just For Debugg
                _busy.Set();
                Start_Back.Text = "Pause";
                backgroundWorker1.RunWorkerAsync(tempCicle);   
            }
            else
            {
                _busy.Reset();
                Start_Back.Text = "Resume";
            }

            btnStop.Enabled = true;

Then in backgroundworker doWork I wrote this:

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
     m_addTab addTabsInvoke = addTabUrl2;
      Invoke(addTabsInvoke, "http://www.google.com");
        foreach (something)
                {
                    _busy.WaitOne();

                    if (backgroundWorker1.CancellationPending)
                    {
                        return;
                    }
                    if (tabs.InvokeRequired)
                        {
    ......
    ......

I can’t understand why pause works while resume doesn’t work. Did I wrong something?

  • 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-27T04:49:56+00:00Added an answer on May 27, 2026 at 4:49 am

    My best guess for what you want:

    void ResumeWorker() {
         // Start the worker if it isn't running
         if (!backgroundWorker1.IsBusy) backgroundWorker1.RunWorkerAsync(tempCicle);  
         // Unblock the worker 
         _busy.Set();
    }
    
    void PauseWorker() {
        // Block the worker
        _busy.Reset();
    }
    
    void CancelWorker() {
        if (backgroundWorker1.IsBusy) {
            // Set CancellationPending property to true
            backgroundWorker1.CancelAsync();
            // Unblock worker so it can see that
            _busy.Set();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a winform application (one form), on this form there is a RichTextBox.
I have a for loop setting the background images on buttons, basically the buttons
I have a loop like this: for i=1:no %some calculations fid = fopen('c:\\out.txt','wt'); %write
I have a loop created with each, check this example: $('.foo').each(function(i){ //do stuff });
Sorry if this seems like a dumb question but I am just learning bash
I currently have a loop something like this: foreach(var item in theList) { //create
I have a background worker process that starts provisioning a new client for our
I have a code that goes like this on HTML: <div class=blog_highlight> <ul class=calendar>
I have a class that plays a repeating background music loop with an AVAudioPlayer
I have loop designed to validate the user input on a question, it was

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.