My VB.NET is rusty, so hopefully you can figure out the equivalent code.
This c# code will work:
string x = rs.fields("formname")
// note that formname must be the full name of the class
// including the namespace
Type formType = Type.GetType(x);
System.Reflection.ConstructorInfo constructor =
formType.GetConstructor(new Type[0]);
Form newForm = (Form) constructor.Invoke(new object[0]);
newForm.Show();
The key methods to look at are the static Type.GetType() and instance
method Type.GetConstructor(). They will let you create an instance of
an class, when you only have the name of the class as a string.
Joshua Flanagan
http://flimflan.com/blog
Tom T via DotNetMonster.com wrote:
Hello all.. I'm making a dynamic menu in VB net for an aplication but i'm
having an issue ...
I need to use a varable as part of an argument when opening new forms..
example..
Dim X as string
x= rs.fields("formname")
dim View me as new X
how do I get VB.Net to reconize that x is an aculy form and create a new
instance of it...
Many thanks,
Tom T