Hi
I am trying to set a class as a property of another class.
I have one class clsCompany and another clsPerson
I am trying to set clsPerson as a property of clsCompany and as an array.
Elsewhere in clsCompany I am setting the number of of 'clsPerson' instances (PersonCount) and creating a local array of Person instances (moPerson).
I then try and return the clsPerson as follows in my code
Code:For intCnt = 1 To oCompany.PersonCount Debug.print oCompany.Person(intCnt).Surname NextAs soon as it gets to 'Set Person(iI) = New clsPerson' it just loops through from 'Public Property Get Person...'Code:Public Property Get Person(ByVal iI As Integer) As clsPerson Set Person(iI) = New clsPerson 'Problem with this line iI = iI - 1 If iI >= 0 And iI <= UBound(moPerson) Then Set Person(iI) = moPerson(iI) End If End Property
How can I best achieve what I am trying to do?
Many thanks in advance.




Reply With Quote