|
-
Jun 15th, 2011, 02:00 PM
#1
Thread Starter
Frenzied Member
Class / Class within Class/ & Array problems
Hello,
I seem to be having some trouble with Classes & arrays etc...
So my structure is as follows:
Code Code:
Class1
--Method
--Method
--Class2.Property
--Class2.Property
--Class2.Class3.Property
--Class2.Class3.Property
But Assuming Class2 needs to be an Array(0 to 10) thats when we have problems assigning things!!
Dim test as Class2
Set test = new class2
test = myFunction(myString)
where myFunction is:
myFunction(test as string) as Class2
dim dummyObg AS CLASS2
set dummyOBg as new class2
redim dummyobj(0 to 10)
'code
'code
myFunction = dummyobj
end Function
Do i have to copy each array separately?
i.e array(0) = testarray(0)
array(1) = testarray(1)
etc.. etc..
Can't you just do: array = testarray ?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Jun 15th, 2011, 02:17 PM
#2
Re: Class / Class within Class/ & Array problems
How can Class2 be an array? It's a Class.
Skinny this down to a very simple example and maybe we'll be able to see where you have gone wrong.
It would not hurt a bit to STOP. Then go read the manual on Programming with Objects which you can also find in your MSDN CDs.
-
Jun 15th, 2011, 03:45 PM
#3
Thread Starter
Frenzied Member
-
Jun 16th, 2011, 06:06 PM
#4
Re: Class / Class within Class/ & Array problems
Do i have to copy each array separately?
i.e array(0) = testarray(0)
array(1) = testarray(1)
etc.. etc..
Can't you just do: array = testarray ?
All you have to do is to give it a try. Then you will see what works and what doesn't work.
A class cannot be an array but you can have an array of classes.
Class1.Class2(3).Method.Class3.Value
Looks like something I saw in a Java or C/C++ program.
Class1 creates instances of Class2 and is refering to the 3rd instance. Is that what you are intending it to be?
Class2 has a method called Method (in your example)
Method has an instance of Class3 and Class3 has a property called Value
So, I guess you have this:
Class1.Class2(3).Method.Class3.Value
Is this what your intentios are?
I don't know if that will work or not.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Tags for this Thread
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
|