Check-out the Activator.CreateInstance methods and
AppDomain.CreateInstanceAndUnwrap()

I find AppDomain.CreateInstanceAndUnwrap() to be a bit more useful.

If your class will be in the same assembly and namespace then you can do
something like:
Dim o As Form = CType(AppDomain.CurrentDomain.CreateInstanceAndUnwrap
(Assembly.GetCallingAssembly.FullName, (Me.GetType.Namespace
+ ".MyClass")),Form)
o = CType(Activator.CreateInstance(Assembly.GetCallingAssembly.FullName,
(Me.GetType.Namespace + ".MyClass")).Unwrap,Form)

replacing ".MyClass" with the "." + variable; in your case.

I would suggest including the namespace wherever you're storing the form
type names to make it more flexible.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to