How can I restrict my child form from opening more than once in MDI in VB.NET?

How can I restrict my child form from opening more than once (I want to restrict multiple instance of a form) in MDI in VB.NET?
There's no direct way to check if a particular form is loaded. One way to solve the problem is to create a static property in the form class and set that static variable to true when you load the form and when you close the form, set it to false. Of course you'll have to handle the Loaded and Closed events to properly set the static variable. If you want to get the instances of the loaded forms, you could have a static array that you add and remove form instances to, you could do that as well.
This was first published in March 2004

Dig deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: