Ik probeer een waarde toe te voegen aan een collection, dat lukt.. maar als ik hem dan probeer te lezen bij de for/each in het form krijg ik deze error.
Error: Object doesn't support this property or method
Ziet iemand wat ik fout doe?
Form:
Class: cContact
Class: cFunction
Class: cType
Error: Object doesn't support this property or method
Ziet iemand wat ik fout doe?
Form:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| Sub Form_Load()
Dim Contact As cContact
Dim Item As cType
Set Contact = New cContact
Contact.Create ("Jeff")
For Each Item In Contact.ReadCol
Debug.Print Contact.ReadCol
Next
End Sub |
Class: cContact
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| Option Explicit Dim cList As New cFunction Public Property Get ReadCol() As cFunction Set ReadCol = cList End Property Public Function Create(naam As String) As cFunction Set cList = Nothing cList.Add naam Set Create = cList End Function |
Class: cFunction
code:
1
2
3
4
5
6
7
| Option Explicit Dim tcontact As New Collection Public Function Add(naam As String) As cType tcontact.Add naam End Function |
Class: cType
code:
1
2
3
| Option Explicit Public Name As String |