MdiParent to fire event on adding/removing a MdiChild

M

MuZZy

Hi,

I wounder if someone could help me here: app has an MdiParent form - i
need to get some notification in form of an event when any MdiChild
forms are added to/removed from MdiParent.MdiChildren collection. I have
no control over children forms so i peed the parent form to fire this
event.

I didn't find any events of Form that would handle that.
Any ideas would be highly appreciated!

Thank you,
MuZZy
 
K

Kevin Yu [MSFT]

Hi MuZZy,

As far as I know, there is no event fired when you add a child form to an
MDI parent form. However, when you make a child form to be the MDIChild of
the parent form, you will always need to call childForm.MdiParent =
parentForm;

So in this case, you can do whatever after this line of code.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
M

MuZZy

Kevin said:
Hi MuZZy,

As far as I know, there is no event fired when you add a child form to an
MDI parent form. However, when you make a child form to be the MDIChild of
the parent form, you will always need to call childForm.MdiParent =
parentForm;

So in this case, you can do whatever after this line of code.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Well, i actually found an answer for that: When you set the from as
MdiParent, it adds a MdiClient object to that form. This object is
responsible for managing Mdi Child forms and it has events
ControlAdded/ControlRemoved which fire whenever an MdiChild is added
to/removed from parent Form.MdiChildren collection

I tried and it works just fine

Andrey
 
K

Kevin Yu [MSFT]

Hi Andrey,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top