troubleshooting Question

How can I check whether a form exists from its type and if so access its properties?

Avatar of chrisbray
chrisbrayFlag for United Kingdom of Great Britain and Northern Ireland asked on
38 Comments1 Solution296 ViewsLast Modified:
I need to be able check all MDI children for a specific type of form, and then if I find it check its properties to see if they match a known specification - this is to be able to determine if the particular form and its data already exists - if so, bring it to the front, if not create it.  

The reason for this requirement is that I have multiple use forms, so there could be multiple instances of a single form each of which could contain information about a range of different things and this is determined by properties such as EditID which contains the ID of the current record being edited.  Others determine the table, and so on.  

In Delphi this is pretty simple, because you can use GetPropInfo^ to access the form's properties, and you can pass the form type directly to the method.  I can get the form type in C#:

Type type = Type.GetType("MyNamespace.MyForm");

I can also loop through the MDI children, but that is where my plan falls down...

Can anyone advise the best way to achieve this?

Chris Bray.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 38 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 38 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros