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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:36:33+00:00 2026-05-31T07:36:33+00:00

i cant get the progress bar to work! if i execute the following code

  • 0

i cant get the progress bar to work! if i execute the following code the bar remains empty even if the code gets executed the ReportProgress doesnt seem to update anything..:

namespace GPUZ_2

{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        GPUZdata test = new GPUZdata
        {
        };

        //invio l'oggetto al thread backgroundworker
        backgroundWorker1.RunWorkerAsync(test);
    }


    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
        //
        // e.Argument always contains whatever was sent to the background worker
        // in RunWorkerAsync. We can simply cast it to its original type.
        //
        GPUZdata argumentTest = e.Argument as GPUZdata;




        argumentTest.OneValue = 6;
        Thread.Sleep(2000);
        backgroundWorker1.ReportProgress(50);
        argumentTest.TwoValue = 3;
        Thread.Sleep(2000);
        backgroundWorker1.ReportProgress(100);


        //
        // Now, return the values we generated in this method.
        // Always use e.Result.
        //
        e.Result = argumentTest;
    }


    private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {

         // Receive the result from DoWork, and display it.

        GPUZdata test = e.Result as GPUZdata;
        this.Text = test.OneValue.ToString() + " " + test.TwoValue.ToString();

     }

    private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
    {
        // Change the value of the ProgressBar to the BackgroundWorker progress.
        progressBar1.Value = e.ProgressPercentage;
        // Set the text.
        this.Text = e.ProgressPercentage.ToString();
    }
}

}

thanks in advance for your help

  • 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-31T07:36:35+00:00Added an answer on May 31, 2026 at 7:36 am

    To initialize the BackgroundWorker, you must enable progress reporting and hook up your event handlers:

    // Enable progress reporting
    backgroundWorker1.WorkerReportsProgress = true;
    
    // Hook up event handlers
    backgroundWorker1.DoWork += backgroundWorker1_DoWork;
    backgroundWorker1.RunWorkerCompleted += backgroundWorker1_RunWorkerCompleted;
    backgroundWorker1.ProgressChanged += backgroundWorker1_ProgressChanged;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get my progress bar to work. Any help is much appreciated! Here's
I'm probably doing something realy stupid but I cant get this to work: var
Cant seem to get the following to find the 'skull' button when the 'heart'
I am trying to get simple Progress bar when I clicking on item list
I cant get a PHP file to send correct headers at my WAMP server.
with $element->children() i cant get all the child elements of current element. but how
I am generating assembly on runtime . Problem is that i cant get rid-of
Im trying to plot the roots of a polynomial, and i just cant get
I cant quite get my head around what the ^ is doing in my
I have read other related question but i cant really get them to relate

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.