Hi, I want to initialize a variable having the name of a class. Is is possible or not? Thanks!
Afzal_j56
Printable View
Hi, I want to initialize a variable having the name of a class. Is is possible or not? Thanks!
Afzal_j56
http://www.vbforums.com/attachment.p...id=47243&stc=1
I'm sorry but I don't understand your question.
Basic class initialization:
VB Code:
' declaration (ie. in general declarations) Dim Something As clsClassName ' initialization for use (ie. on Form_Load) Set Something = New clsClassName ' once done, clearing from memory (ie. on Form_Unload) Set Something = Nothing
As far as I know, you can't create a new class by using a string variable.
Edit
1 AM
tut tut merri ;)Quote:
Originally Posted by Merri
I am Initialing my classes by the following way,
CASE SomeValue
Case 1
Set Var1 = New Class1
Case 2
Set Var1 = New Class2
and so on.
Is there any way to Initialize these classes dynamically by keeping the Class Name in a variable (strVariable) and set as follows,
Set Var1 = New strVariable
Thanks in Advance.
You can't create a new copy of a class with a string. What you're trying to achieve?