Hi,
I am trying to create a hierarchical structure for my collection class but I got an error on the third one.
Here's my structure
class1
class1collection
class2
class2collection
class3
class3collection
class2 collection and class3 collection contains almost the same code :
for class2:
Public Function Add(firstclass as class1, Caption as string) as class1
Dim cls as class2
set cls = new class2
with cls
set .child = firstclass
.Caption = Caption
end with
mcolClass2.add cls
set Add = cls
set cls = nothing
end function
class 3 collection has the same code except for the variables.
When I reference it as
dim cl1 as class1collection
dim cl2 as class2collection
dim cl3 as class2collection
set cl1 = new class1collection
set cl2 = new class2collection
set cl3 = class2collection
cl1.add "class1"
cl2.add cl1,"First"
cl3.add cl2,"Top Level"
I receive no error during the insertion process however, if I will access it as:
cl2.item(1).cl1.item(1).Caption - it is OK
cl3.item(1).Caption - it is OK
cl3.item(1).cl2.item(1).Caption - I get the error here, I wonder why.
Can anybody give me a hint as to why this happen?
Thanks in advance, this is urgent please assist me.
I am trying to create a hierarchical structure for my collection class but I got an error on the third one.
Here's my structure
class1
class1collection
class2
class2collection
class3
class3collection
class2 collection and class3 collection contains almost the same code :
for class2:
Public Function Add(firstclass as class1, Caption as string) as class1
Dim cls as class2
set cls = new class2
with cls
set .child = firstclass
.Caption = Caption
end with
mcolClass2.add cls
set Add = cls
set cls = nothing
end function
class 3 collection has the same code except for the variables.
When I reference it as
dim cl1 as class1collection
dim cl2 as class2collection
dim cl3 as class2collection
set cl1 = new class1collection
set cl2 = new class2collection
set cl3 = class2collection
cl1.add "class1"
cl2.add cl1,"First"
cl3.add cl2,"Top Level"
I receive no error during the insertion process however, if I will access it as:
cl2.item(1).cl1.item(1).Caption - it is OK
cl3.item(1).Caption - it is OK
cl3.item(1).cl2.item(1).Caption - I get the error here, I wonder why.
Can anybody give me a hint as to why this happen?
Thanks in advance, this is urgent please assist me.