We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing form.MdiParent with TabbedMDIManager causes OnLoad to be called multiple times

Thread ID:





59506 Apr 16,2007 09:11 AM UTC Apr 20,2007 02:15 PM UTC WinForms 3
Tags: Tools
James Sandys-Lumsdaine
Asked On April 16, 2007 09:11 AM UTC

I'm using multiple mdi parent forms each with their own TabbedMDIManager instance. I want to be able allow the user to open the currently active tab (mdi child) in a new parent form ( a "Open in New Window" option).

So when the user clicks on this option, they expect to see the control move from the current form to a new one. The control itself is recreated - just has it's MdiParent changed.

I've implemented this with the following code:

private void AttachForm(MainForm mdiParent, DockedForm mdiForm)
// NOTE: set the MDI parent to null first otherwise the form does not seem
// to attach properly to the new parent
mdiForm.MdiParent = null;
mdiForm.MdiParent = mdiParent;

Firstly, I found I had to clear the MdiParent before setting it to a new form. Otherwise, the child would never appear in the new form.

Secondly and more importantly, by changing the MdiParent property it causes the OnLoad and OnCreateControl() methods to be called each time.

OnLoad() should only be called once when the control is created - all I'm doing here is changing the MDI parent. A small test app without the TabbedMDIManager does not cause the OnLoad method to be called multiple times.

I've looked in the TabbedMDIManager source code but can't see why this is happening. Can you please advise how I can implement this functionality without the same control instance being initalised repeatedly.


James Sandys-Lumsdaine
Replied On April 16, 2007 09:14 AM UTC

>The control itself is recreated -

Sorry - this should read "The control itself is NOT recreated - ...".

James Sandys-Lumsdaine
Replied On April 19, 2007 04:46 PM UTC

Any help on this? Thx.

Golda Rebecal [Syncfusion]
Replied On April 20, 2007 02:15 PM UTC

Hi jas_sl,

Sorry for the delay in responding.

1) When MDI parent of a tabbed MDI child form is changed, the MDIParent have to be cleared before setting the new parent

I could see this issue only when the child is transferred to a MDI parent without having any child. I will forward this issue to the development team and they will get back to you. In the attached sample, I have changed the MDI parent without clearing it and the child is transferred to the new form that is already having a mdi child

2) OnLoad() method of the MDI child is called when the MDI parent of the child form is changed.

I am afraid that I am not able to reproduce the issue with the attached sample. Could you please modify the sample so that the issue could be reproduced? This will help us to resolve the issue soon.

Thanks for using Syncfusion products.


Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon