mel C

mel C

  • NA
  • 8
  • 0

How to update progress bar in a modal window?

Dec 2 2008 10:55 PM

Hi,

I'm a novice in C#. I wrote a program to export data from datagridview. While exporting, a pop-up window with a progress bar will show the progress of file being written. On the main form, I wrote:

BackgroundWorker bgw = new BackgroundWorker();

bgw.DoWork += delegate
{
     //Code for exporting data
};

bgw.RunWorkerAsync();
FrmProgress progress = new FrmProgress();
progress.Show();

bgw.RunWorkerCompleted += delegate
{
progress.Close();
};

The pop-up window showed up while exporting, but the progressbar on the modal window is not updated. I tried bgw.ReportProgress but getting an error. Probably I didn't use it correctly. How do I update the progressbar in modal window? Can anyone please help me with this?

Thanks in advance!

 


Answers (5)