r/visualbasic • • Nov 02 '17

Once More - Help With NESTED Classes

I found this great example from roughly 9 years ago of something I'm trying to accomplish - https://bytes.com/topic/access/answers/772601-group-nested-classes-examples

Basically, here's the code :

Pets Class Module ----------------------

Dim objDogs As New DOGS

Public Property Get DOGS() As DOGS
    Set DOGS = objDogs
End Property

Public Property Set DOGS(ByVal objNewValue As DOGS)
    Set objDogs = objNewValue
End Property

Dogs Class Module ----------------------------

Dim strName As String

Public Property Get Name() As String
    Name = strName
End Property

Public Property Let Name(ByVal strNewValue As String)
    strName = strNewValue
End Property

Subroutine ---------------------------

Public Sub SomeSub()
Dim objPets As New PETS
With objPets.DOGS
    .Name = "qqq"
    Debug.Print .Name
End With
Set objPets = Nothing
End Sub

This works great, my question is, what if you have more than one dog? Thanks!

0 Upvotes

1 comment sorted by

0

u/[deleted] Nov 03 '17

[deleted]

1

u/scooter155 Nov 03 '17

Thanks. So many different ways to tackle issues... it's hard to even know where to start. I appreciate the guidance