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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:23:46+00:00 2026-05-23T22:23:46+00:00

I am attempting to add a progress bar in my c# excel add in.

  • 0

I am attempting to add a progress bar in my c# excel add in. The progress bar appears but it does not indicate any progress until the function is finished executing.

These are the functions in the Windows Form Class:

    public void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
        for (int i = 0; i < 100; i++)
        {

            Thread.Sleep(100);

            backgroundWorker1.ReportProgress(i); //run in back thread


        }

    }



    public void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) //call back method
    {

        progressBar1.Value = e.ProgressPercentage;

    }

    public void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) //call back method
    {

        progressBar1.Value = progressBar1.Maximum;

    }

This is how I call the function from the add in button:

    private void buttonClicked(object sender, RibbonControlEventArgs e)
    {
        AddInPlanView.Form1 pBar = new AddInPlanView.Form1();

        pBar.Visible = true;

        pBar.backgroundWorker1.WorkerReportsProgress = true;

        pBar.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(pBar.backgroundWorker1_ProgressChanged);

        pBar.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(pBar.backgroundWorker1_DoWork);

        pBar.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(pBar.backgroundWorker1_RunWorkerCompleted);

        pBar.backgroundWorker1.RunWorkerAsync();

        FUNCTIONTORUN();

        pBar.Visible = false;

    }

How should I change this so that the progress bar will not stop working during the execution of FUNCTIONTORUN()? The progress bar is initialized using the Visual Studio designer. The name of the progressbar object in the form class is progressbar1.

Thank YOU!

  • 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-23T22:23:47+00:00Added an answer on May 23, 2026 at 10:23 pm

    The DoWork event for your progress bar should be (or contain) FUNCTIONTORUN(). FUNCTIONTORUN() should use the ReportProgress method.

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

Sidebar

Related Questions

I'm attempting to add a FB Like Box to a website I'm developing. Not
I'm attempting to add a UIImageView to the subview of a UILabel, but for
I'm attempting to add this .click function to each image I'm sorting with the
I am attempting to add a shape aesthetic mapping to an existing plot but
I am attempting to add items to an application bar with behavoirs. In xaml
I am attempting to add an item to the application menu-bar of a simple
I'm attempting to add a function to my site where users can set their
I am attempting to add embedded documents. I know this syntax is wrong but
I am attempting add a tableadapter to a stored procedure in my SQL Server
I am attempting add some tests to an existing QT GUI application using QTest.

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.