K
Karl
Hi,
I'm just writing my first real c# application and I have a problem
when trying to access a control in a child form.
I am using an MDI application with a parent form called frmMain. In
this code I need to parse some files whose filenames are in an
arraylist. Since this parsing may take some time, I want to display a
child form named frmProgress (created as frmProgessBar) that will show
a ProgressBar and update it during processing.
In frmMain I have code that looks like this:
frmProgress frmProgressBar = new frmProgress ();
frmProgressBar.MdiParent = this;
frmProgressBar.Show ();
// need to set progressbar maximum and minimum here
foreach (string s in FilesArray)
{
// do processing of files here
// update progressbar value on each iteration.
}
Now, my question is: how can I access the actual ProgressBar control
in the child? (i.e. provide the code for the comments above). I can
access the child form methods such as Show but I don't know how I can
access the control methods so that I can set the maximum, minimum and
value of the ProgressBar control.
Can I somehow use frmProgressBar.Controls to access the ProgessBar or
is there a way to reference it using the progressbar name?
Thanks
Karl
I'm just writing my first real c# application and I have a problem
when trying to access a control in a child form.
I am using an MDI application with a parent form called frmMain. In
this code I need to parse some files whose filenames are in an
arraylist. Since this parsing may take some time, I want to display a
child form named frmProgress (created as frmProgessBar) that will show
a ProgressBar and update it during processing.
In frmMain I have code that looks like this:
frmProgress frmProgressBar = new frmProgress ();
frmProgressBar.MdiParent = this;
frmProgressBar.Show ();
// need to set progressbar maximum and minimum here
foreach (string s in FilesArray)
{
// do processing of files here
// update progressbar value on each iteration.
}
Now, my question is: how can I access the actual ProgressBar control
in the child? (i.e. provide the code for the comments above). I can
access the child form methods such as Show but I don't know how I can
access the control methods so that I can set the maximum, minimum and
value of the ProgressBar control.
Can I somehow use frmProgressBar.Controls to access the ProgessBar or
is there a way to reference it using the progressbar name?
Thanks
Karl