how can i show progress in Progress bar on MDI form from child form
-
i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer any help or code snippet or links may be appreciable.. thanks in advance. Regards
-
i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer any help or code snippet or links may be appreciable.. thanks in advance. Regards
Follow some simple steps: 1. Make the progressBar internal so that child form can access it. 2. Now access the progress bar like (child.MdiParent as ParentForm).progressBar. 3. Make sure you have a synchronization mechanism is on place so that at a time only one child form can access the proressbar. [where child is the Child Form, ParentForm is the class name of the MDI form and progressBar is the control in MDI form.] Or, if you do not want to expose the control as internal then create some event in Child Form like
public event EventHandler<ProgressChangedEventArgs> ProgressChanged;
Then subscribe this event in parent form like
child.ProgressChanged += Child_ProgressChanged;
void Child_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
// put your code here
}and then call the event from child form like
if(ProgressChanged != null)
ProgressChanged(this, new ProgressChangedEventArgs(progressPercentage, null));Regards, Anindya Chatterjee[^]
-
i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer any help or code snippet or links may be appreciable.. thanks in advance. Regards
-
Thanks for your replies guys.. i got the solution by making progress bar static internal. after dragging the progress bar control on form i made its access modifier internal, and i manually changed some code of progress bar control in Designer.cs file. through this i became able to get the progress bar like, MDIForm.PrgressBar_watinting.value=some value.. Regards