PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms How do I allow MDI Child Form A to know if MDI Child Form B is open in C#?

Reply

How do I allow MDI Child Form A to know if MDI Child Form B is open in C#?

 
Thread Tools Rate Thread
Old 12-12-2005, 05:57 PM   #1
kstuver
Guest
 
Posts: n/a
Default How do I allow MDI Child Form A to know if MDI Child Form B is open in C#?


Greetings:

I have an MDI application. I need for MDIChildFormA to be able to
determine if MDIChildFormB is open, so I can display a message to
finish edits in and close MDIChildFormB before I proceed with a delete
operation in MDIChildFormB.

How do I determine from MDIChildFormA if MDIChildFormB is open?

Thanks!!
Kent

  Reply With Quote
Old 12-12-2005, 09:57 PM   #2
Michael Höhne
Guest
 
Posts: n/a
Default Re: How do I allow MDI Child Form A to know if MDI Child Form B is open in C#?

Hi Kent,
you can use the MdiParent property of MDIChildFormA to get the MDI
container, which holds a list of all currently opened windows in its
MdiChildren property, so something like

foreach(Form mdiChildForm in this.MdiParent.MdiChildren) {
if (mdiChildForm == MDIChildFormB) {
//do your processing here
}
}

Of course, you cannot use the above comparison because you will likely not
have a reference to it, but I'm sure you'll find some properties that
uniquely identify the form in question.

Michael



"kstuver" <whiteboard2004-programmer@yahoo.com> schrieb im Newsbeitrag
news:1134410237.051933.57480@z14g2000cwz.googlegroups.com...
> Greetings:
>
> I have an MDI application. I need for MDIChildFormA to be able to
> determine if MDIChildFormB is open, so I can display a message to
> finish edits in and close MDIChildFormB before I proceed with a delete
> operation in MDIChildFormB.
>
> How do I determine from MDIChildFormA if MDIChildFormB is open?
>
> Thanks!!
> Kent
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off