How to update the progress bar in runtime using c#

Posted by karthik on Stack Overflow See other posts from Stack Overflow or by karthik
Published on 2010-04-14T06:36:23Z Indexed on 2010/04/14 6:43 UTC
Read the original article Hit count: 191

Filed under:

I am using the below code to update my progress bar.

        ProgressBar.Visible = true; 
        ProgressBar.Minimum = 1; 
        ProgressBar.Maximum = PortCount; 
        ProgressBar.Value = 1; 
        ProgressBar.Step = 1; 

        int intdata = 5;
        for (int x = 1; x <= intdata; x++)
          {
            ProgressBar.PerformStep();
        }

        MessageBox.Show("Done");

But, it is not getting updated during runtime. Is it because the progress bar is in the same thread. If so, how to update this progress from another thread. Help...

© Stack Overflow or respective owner

Related posts about c#