PDA

Click to See Complete Forum and Search --> : How to create a new instance of a class at runtime?


Yupper
Feb 27th, 2001, 12:53 PM
I've been trying to dinamically create instances of a class that I created but it seems that VB6 does not provide a lot of support on this topic.

I can use:

public myClass as new classType

or

dim myClass as new classType


but it is not enough.

Is there anything like a pointer to a class like in C++? Say, what is the equivalent of this in VB:

myClass *pointer;

pointer = new myClass;

.
.
.



Thanks!

parksie
Feb 27th, 2001, 01:23 PM
Well, you can declare an object reference:

Dim x as MyClass
Dim y as New MyClass

Set x = New MyClass
Set x = Nothing ' Destroy

Set x = y