progress bar on MDI
-
Hi, I have a progress bar in my MDI application in the parent form and I want it to perform step when a condition that depends on a loop variable in the child form is satisfied. What is the simplist way to do that? In my child form:
for (i =0 ; i<NUM ; i++) //do something
I have tried to check at regular intervals if the conditions is satisfied or not using a timer in the parent form:if ( (child->i%1000) == 0 ) this->progressbar->PerformStep();
the problem here is that the steps are all performed at once when the loop is finished! any ideas? thanks, -
Hi, I have a progress bar in my MDI application in the parent form and I want it to perform step when a condition that depends on a loop variable in the child form is satisfied. What is the simplist way to do that? In my child form:
for (i =0 ; i<NUM ; i++) //do something
I have tried to check at regular intervals if the conditions is satisfied or not using a timer in the parent form:if ( (child->i%1000) == 0 ) this->progressbar->PerformStep();
the problem here is that the steps are all performed at once when the loop is finished! any ideas? thanks,First, why not have the child form itself update the progress bar? Then you don't have to do all that polling. Or if you must do polling, make sure to call Application.DoEvents() and Thread.Sleep() in your wait loop; not doing this is probably what causes the steps to "all [be] performed at once."
A little learning is a dangerous thing; Drink deep, or taste not, the Pierian Spring. —Alexander Pope
-
First, why not have the child form itself update the progress bar? Then you don't have to do all that polling. Or if you must do polling, make sure to call Application.DoEvents() and Thread.Sleep() in your wait loop; not doing this is probably what causes the steps to "all [be] performed at once."
A little learning is a dangerous thing; Drink deep, or taste not, the Pierian Spring. —Alexander Pope
CompMan44 wrote:
First, why not have the child form itself update the progress bar?
Because I don't know how to access a control (progress bar in my case) that is located on a parent form FROM a child one. The progress bar must be in the parent form because the loop that I'm using is in the (onload event) of the child form. So the whole idea of this progress bar is to indicate how long the child form will take to be completely load.
-
CompMan44 wrote:
First, why not have the child form itself update the progress bar?
Because I don't know how to access a control (progress bar in my case) that is located on a parent form FROM a child one. The progress bar must be in the parent form because the loop that I'm using is in the (onload event) of the child form. So the whole idea of this progress bar is to indicate how long the child form will take to be completely load.
If I were you, I would investigate the BackgroundWorker class. There are many examples scattered over the net that show you how to use this with the progressbar to show progress.
Deja View - the feeling that you've seen this post before.
-
Hi, I have a progress bar in my MDI application in the parent form and I want it to perform step when a condition that depends on a loop variable in the child form is satisfied. What is the simplist way to do that? In my child form:
for (i =0 ; i<NUM ; i++) //do something
I have tried to check at regular intervals if the conditions is satisfied or not using a timer in the parent form:if ( (child->i%1000) == 0 ) this->progressbar->PerformStep();
the problem here is that the steps are all performed at once when the loop is finished! any ideas? thanks,Hi You can used the Threading and Give the interval