Why the child windows cannot to show? VS2005 bug????

  • Thread starter Thread starter abc my vclass
  • Start date Start date
A

abc my vclass

Why the child windows cannot to show? But when I remark the line
"pf.MdiParent = this;", the frmProduct window showed but not a child window.
Is it the VS 2005 bug?



I write the code as:

Caller:
private void AppendProductToolStripMenuItem_Click(object sender,
EventArgs e)
{
frmProduct pf = frmProduct.GetChildInstance();
pf.MdiParent = this;
pf.Show();
pf.BringToFront();
}

frmProduct class:
private static frmProduct m_Productform;
public static frmProduct GetChildInstance()
{
if (m_Productform == null) //if not created yet, Create an
instance
m_Productform = new frmProduct();
return m_Productform; //just created or created earlier.Return
it
}
 
I think that part of it might be the fact that you are re-setting the
MdiParent every time you make the call. If anything, I would send the
parent to the GetChildInstance method, and set the MdiParent once, if you
are creating the form.

Hope this helps.
 

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

Back
Top