I want to be able to reference an open form in my application. I
thought this would be easy by iterating through all forms in the
application but I can't figure out how to do this. I have tried using
the Form.mdiChildren as recommended in another post but this did not
return any results. This does not surprise me as all forms in the
application are forms in their own right.

Any help appreciated...

Re: Iterating through forms in an application by Carsten

Carsten
Wed Feb 11 05:39:16 CST 2004

June Homer wrote:
> I want to be able to reference an open form in my application. I
> thought this would be easy by iterating through all forms in the
> application but I can't figure out how to do this. I have tried using
> the Form.mdiChildren as recommended in another post but this did not
> return any results. This does not surprise me as all forms in the
> application are forms in their own right.
>
> Any help appreciated...

Hi June,

did you set the forms' MdiParent property?



Re: Iterating through forms in an application by hirf-spam-me-here

hirf-spam-me-here
Wed Feb 11 06:41:20 CST 2004

* june@howden.biz (June Homer) scripsit:
> I want to be able to reference an open form in my application. I
> thought this would be easy by iterating through all forms in the
> application but I can't figure out how to do this. I have tried using
> the Form.mdiChildren as recommended in another post but this did not
> return any results. This does not surprise me as all forms in the
> application are forms in their own right.

There is no support for doing that included in the .NET Framework. You
may want to maintain a separate arraylist/collection that stores the
references to the form instances.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Re: Iterating through forms in an application by JezB

JezB
Wed Feb 11 07:53:09 CST 2004

This is what I do. In all my forms I instantiate a FormConfig class from the
Load event, passing it the form reference. So in here I can do anything I
like to affect all my forms - maintain a collection of all open forms,
attach handlers for specific form events (eg. KeyDown to assign and handle
global hotkeys, Closed to remove the form from the collection when it's
closed) etc, all in one central place.

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:urcfNAK8DHA.1716@TK2MSFTNGP10.phx.gbl...
> * june@howden.biz (June Homer) scripsit:
> > I want to be able to reference an open form in my application. I
> > thought this would be easy by iterating through all forms in the
> > application but I can't figure out how to do this. I have tried using
> > the Form.mdiChildren as recommended in another post but this did not
> > return any results. This does not surprise me as all forms in the
> > application are forms in their own right.
>
> There is no support for doing that included in the .NET Framework. You
> may want to maintain a separate arraylist/collection that stores the
> references to the form instances.
>
> --
> Herfried K. Wagner [MVP]
> <http://www.mvps.org/dotnet>