17-12-2008 by Marek Śliwiński
Post moved to new location:
http://code.mareoblo.pl/2008/12/17/c-winforms-%e2%80%93-how-to-check-if-form-is-already-open-and-bring-it-to-the-front-instead-open-new-instance/
Posted in WinForms | Tagged Add new tag, C#, WinForms | 3 Comments
I think you may have to check whether or not the already-open form is minimized, and restore its state if it is prior to BringToFront().
but often form is just in background and not minimized so BringToFront will handle all cases
There might be a problem with this code. All inherited forms from frmOptions will also not open because “is” will return a true for them as well.
A better condition would be to compare types. Right?
http://hashfactor.wordpress.com/2009/01/28/c-check-if-a-form-is-already-opened/
Comments RSS
Name (required)
E-mail (will not be published) (required)
Website
Notify me of follow-up comments via email.
I think you may have to check whether or not the already-open form is minimized, and restore its state if it is prior to BringToFront().
but often form is just in background and not minimized so BringToFront will handle all cases
There might be a problem with this code. All inherited forms from frmOptions will also not open because “is” will return a true for them as well.
A better condition would be to compare types. Right?
http://hashfactor.wordpress.com/2009/01/28/c-check-if-a-form-is-already-opened/