Close child form if already open

Posted by j-t-s on Stack Overflow See other posts from Stack Overflow or by j-t-s
Published on 2010-05-25T12:26:58Z Indexed on 2010/05/25 12:31 UTC
Read the original article Hit count: 108

Filed under:
|
|
|

Hi All

How can I go about closing a Child form if it's already open? And if it isn't already open, then open it?

Thank you

I already have this code, which doesn't work, obviously:

Form ibx = new inbox();
if(ibx.Visible)
ibx.Dispose();
else
ibx.Show();

All that the above does is creates a new form whether or not it's already open.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET