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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:27:27+00:00 2026-06-11T22:27:27+00:00

I tried so many links on this question but couldn’t find any help on

  • 0

I tried so many links on this question but couldn’t find any help on it. I have this code where i execute a .exe file which retrieves data from a web page and shows the results on my listbox. This takes time and the window freezes, i decided to use BackgoundWorker but all the examples use a loop to update the progress bar where in my case there is no loop, how can i make my progressbar increment? Please help me on this one, here is my code,

        labelstat.Text = "Please wait..";
        // Start the child process.
        Process p = new Process();


        // Redirect the output stream of the child process.
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.FileName = "Out.exe";

        p.Start();
        // Do not wait for the child process to exit before
        // reading to the end of its redirected stream.
        // p.WaitForExit();
        // Read the output stream first and then wait.
        string output = p.StandardOutput.ReadToEnd();
        p.WaitForExit();

        checkedListBox1.Items.AddRange(output.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));

I tried putting this on the,

        backgroundWorker_DoWork

method, where it does my task in the background but i have no idea how to increment the progressbar according to the process carried out by my code? 🙁 thank you very much..

  • 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-06-11T22:27:29+00:00Added an answer on June 11, 2026 at 10:27 pm

    Not sure if you’d be able to change a progress bar, after all how do you know what percentage of work the program has done. What you could do though is keep the UI responsive. You’ve probably already got that done using a background worker, but you might be able to do more by adding lines to your UI as the program writes to the output stream (although given that it needs to download data you might find no output until that’s done then it all at once).

    You’d do this by creating a loop that runs until p.HasExisted (indicating the program is finished). In that loop you’d report progress (BackgroundWorker.ReportProgress), maybe passing in the output string array so far. Then, in the background worker’s progress changed event handler you’d update your UI using the array object you passed in when you reported progress.

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

Sidebar

Related Questions

I tried many ways to solve this problem but none works. suppose I have
I know this must be a trivial question, but I've tried many different ways,
I tried searching for this, but couldn't find much. It seems like something that's
I have tried many permutations but they all don't seems to work well. Am
Hello friends I have tried many times but I am not successful than please
I've tried many functions already, but I simply can't figure this out. The right
I've tried many variations of this command: idle.py -e filepath , but it simply
Yes, I have searched and tried many techniques, but nothing seems to work. Here
Apologies for this basic question, but I am noob stumped. The below code works
I tried enough to find in google & android this question. Also did several

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.