How to get a Form object through the form name

  • Thread starter Thread starter Hari
  • Start date Start date
H

Hari

Hi,
I need to get a form instance, by supplying the form name i.e, i
need some thing similar to Class.forName() in Java. I tried it using
System.Type.GetType() method passing the form name as object. But the
prob here is i'm getting an exception saying "System.Type can not be
casted to a System.Windows.Form". How can i get the form object based
on the form name. Any one plz suggest.

Thanks,

Hari
 
Hi Chris,
Thanks for the suggestion. I've already downloaded your class
previously. That was working fine, but for controls other than a Form.
As you have used Parent property which is null for a Form, this does
not work on a Form as it is. Please suggest what has to be modified to
make it work for a Form.
 
Back
Top