Create Instance of a Class from ClassName

G

Guest

I want to pass a variable to a Procedure and have that function instantiate
an instance of that class. For example, I have a Class named "myClass":

CreateInstance ("myClass")

Sub CreateInstance (classname as string)
Dim newinstance as classname
.....
End Sub

Is there anyway that I can do this?
 
G

Guest

Hi Dennis

Try Activator.CreateInstanceFrom - that should do the trick for you.

HTH

Nigel Armstrong
 
C

Cor Ligthert

Dennis,

When you do this, than are programlanguages as VBA or JS the best for that.

However VBNet is made to create good working executes in runtime.

Just my thought

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top