|
-
Aug 3rd, 2006, 02:50 PM
#1
Thread Starter
New Member
Initialize a Class
Hi, I want to initialize a variable having the name of a class. Is is possible or not? Thanks!
Afzal_j56
-
Aug 3rd, 2006, 03:39 PM
#2
Re: Initialize a Class
I'm sorry but I don't understand your question.
-
Aug 3rd, 2006, 03:45 PM
#3
Re: Initialize a Class
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
Last edited by Merri; Aug 3rd, 2006 at 04:45 PM.
-
Aug 3rd, 2006, 03:48 PM
#4
Re: Initialize a Class
 Originally Posted by Merri
VB Code:
' initialization for use (ie. on Form_Load)
Set Something [COLOR=Red][B]=[/B][/COLOR] New clsClasName
tut tut merri
-
Aug 3rd, 2006, 04:36 PM
#5
Thread Starter
New Member
Re: Initialize a Class
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.
Last edited by Afzal_J56; Aug 3rd, 2006 at 04:41 PM.
-
Aug 3rd, 2006, 05:00 PM
#6
Re: Initialize a Class
You can't create a new copy of a class with a string. What you're trying to achieve?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|