The documentation and error messages are letting me down here, so I’m hoping someone that has gotten this to work before can shed some light on why this wouldn’t work. I’m trying to create some simple custom classes here, and I’m running into trouble with the following code. The functionality is not complete as I have just begun, but this is where I’m stuck.
(Here is a related class I’m including for completeness):
Class Resource
Private docResource As NotesDocument
Private sName As String
Private nnAdmin As NotesName
Private sTermAction As String
Private lSequence As Long
Sub New (doc As NotesDocument)
Set docResource = doc
sName = docResource.GetItemValue(FIELD_RESOURCENAME)(0)
Set nnAdmin = New NotesName(docResource.GetItemValue(FIELD_RESOURCEADMIN)(0))
sTermAction = docResource.GetItemValue(FIELD_TERMACTION)(0)
lSequence = docResource.GetItemValue("FIELD_SEQUENCE")(0)
End Sub
Sub Save
Call docResource.Save(True, True)
End Sub
End Class
Here is what I’m having trouble with:
Class ResourceCollection
Private ResourceDocs() As Resource
Private lIndex As Long
Public Property Get Count As Long
Count = Ubound(ResourceDocs) + 1
End Property
Sub New(ResourceDocCollection As NotesDocumentCollection)
lIndex = 0
Redim ResourceDocs(ResourceDocCollection.Count - 1)
Forall doc In ResourceDocCollection
Set ResourceDocs(lIndex) = New Resource(doc)
lIndex = lIndex + 1
End Forall
End Sub
End Class
So this complains that ResourceDocCollection is not an “array, list, collection or variant”, when I clearly have explicitly declared it to be a collection.
So next I tried the following:
Class ResourceCollection
Private ResourceDocs() As Resource
Private lIndex As Long
Public Property Get Count As Long
Count = Ubound(ResourceDocs) + 1
End Property
Sub New(ResourceDocCollection As NotesDocumentCollection)
Dim rdc As Variant
Set rdc = ResourceDocCollection
lIndex = 0
Redim ResourceDocs(ResourceDocCollection.Count - 1)
Forall doc In rdc
Set ResourceDocs(lIndex) = New Resource(doc)
lIndex = lIndex + 1
End Forall
End Sub
End Class
This complains about a type-mismatch with doc.
Can someone let me know what I’m doing wrong here? Also, should I be declaring my classes as extending NotesDocumentCollection and NotesDocument specifically (as in “Class ResourceCollection As NotesDocumentCollection”)? I wasn’t planning on doing that as I don’t really need to open up the full functionality of those classes for using mine.
Thank you for any help with this.