Forms and Parent property

Something has changed between how VS2003 and beta 2 and I need help in indentifying that.

I have one form that I call a parent form.  This form in not a MDI form.  Within the parent form code I create a new form and make it a child of my parent form.  The code is below.

Form frm = new frmChildTest();
frm.TopLevel = false;
frm.Parent = this;
frm.Show();

It works, the new form, my child form, is contained within my parent form.

Now I want the child form to no longer be contained within the parent.  So in a button event of the child form I place the code:
private void btnUndock_Click(object sender, EventArgs e) {
 this.Parent = null;
 this.TopLevel = true;
}

When executed, the child form should be no longer contained within the parent.

Under VS2003 it behaves as I described.  Under beta 2, when the click event occures, the form disappears and I cannot find it.

Any ideas what changed or what I should be doing to address this

THanks very much!

Al



Answer this question

Forms and Parent property

  • Admiralman

    This looks like a bug. Can you open a bug so we can track this Please include a simple repro of your scenario. Compatibility with 1.0/1.1 is a primary issue that we need to ensure and address.

    thanks,
    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

  • Forms and Parent property