Detecting if a window is already open (MDI app)

  • Thread starter Thread starter Mitchell Vincent
  • Start date Start date
M

Mitchell Vincent

I have an MDI application here and I would like to have one of the
windows only show once (maximize and get the focus if it has already
been created).

How can I check if a window already exists in an MDI app?

Thanks!
 
One way is to add a Module with a Boolean variable. When you go to create
an instance of the window, see if the variable is set to True. If it is,
just Activate the current instance of the window. If not, create a new
instance of the window and set the variable to True. You can set the
variable to false in the Closing event of the window.
 
Michael said:
One way is to add a Module with a Boolean variable. When you go to create
an instance of the window, see if the variable is set to True. If it is,
just Activate the current instance of the window. If not, create a new
instance of the window and set the variable to True. You can set the
variable to false in the Closing event of the window.

Kind of the idea I had - just wondered if there was some trick to it :-)

Thanks Michael!
 

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