how to update progressbar in Child Form from Parent Form
-
Parent Form :
public ProgressBar pb;
private void openChild_Click(object sender, System.EventArgs e)
{
ChildForm cf = new ChildForm();
cf.pf = this;
cf.open();
}Child Form :
public ParentForm pf;
private void runProgressBar_Click(object sender, System.EventArgs e)
{
for(int i = 0;i<100;i++)
{
pf.pb.Value++;
}
} -
Simplest method is to add events to your child form that the parent subscribes to when the form is created. You can then use these to notify the parent that the progress needs changing. Any sample code? Here's Hello World as a Vax-11 macro[^]
Help me! I'm turning into a grapefruit! Buzzwords!
-
Parent Form :
public ProgressBar pb;
private void openChild_Click(object sender, System.EventArgs e)
{
ChildForm cf = new ChildForm();
cf.pf = this;
cf.open();
}Child Form :
public ParentForm pf;
private void runProgressBar_Click(object sender, System.EventArgs e)
{
for(int i = 0;i<100;i++)
{
pf.pb.Value++;
}
}Ick, I hope that was intentionally ironic!
Help me! I'm turning into a grapefruit! Buzzwords!
-
Parent Form :
public ProgressBar pb;
private void openChild_Click(object sender, System.EventArgs e)
{
ChildForm cf = new ChildForm();
cf.pf = this;
cf.open();
}Child Form :
public ParentForm pf;
private void runProgressBar_Click(object sender, System.EventArgs e)
{
for(int i = 0;i<100;i++)
{
pf.pb.Value++;
}
}