Sunday, May 5, 2013

.net check if other forms are open

Problem
I need to know if any other forms are open in the .NET application

Solution
Use Application.OpenForms

This returns a FormsCollection.

In my case I only need to check if the number of objects is greater than 1 (which means there are other forms opened other than the one that this is being called from).


Reference
1. http://msdn.microsoft.com/en-us/library/system.windows.forms.application.openforms.aspx

No comments:

Post a Comment

There was an error in this gadget