471,315 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,315 software developers and data experts.

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

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
}
Dec 6 '05 #1
1 1116
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"abc my vclass" <my********@myclass.com> wrote in message
news:Ox****************@TK2MSFTNGP11.phx.gbl...
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
}

Dec 6 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by James Spibey | last post: by
3 posts views Thread by Maheshkumar.R | last post: by
reply views Thread by Bruin | last post: by
2 posts views Thread by =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.