How to update the progress bar in a modal window?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • melryin
    New Member
    • Dec 2008
    • 5

    How to update the progress bar in a modal window?

    Hi,

    I'm a novice in C#. I wrote a program to export data from datagridview. While exporting, a pop-up window shows the progress of file exporting.

    The code is as follow:

    BackgroundWorke r bgw = new BackgroundWorke r();

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

    bgw.RunWorkerAs ync();
    FrmProgress progress = new FrmProgress();
    progress.Show() ;

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

    The progress bar modal window showed up while exporting data, but the progress bar is not updated. I tried reportprogress but it didn't work. Probably I didn't use it in the right way.

    Can anyone help me with this? I have no idea how to do it.

    Thanks in advance!
  • vanc
    Recognized Expert New Member
    • Mar 2007
    • 211

    #2
    Yes, you have to use reportprogress to show up the changes. Google BackgroundWorke r and you can get many instructions for newbie that really will help you.

    cheers,

    Comment

    • melryin
      New Member
      • Dec 2008
      • 5

      #3
      Hi,

      Thanks for your reply. You are right, I need to ReportProgress. I think that's because I didn't set bgw.WorkerRepor tProgress = true. That's why I got an error message.

      I appreciate for your help. =D

      Comment

      Working...