Item Property (CDONTS Attachments Collection)

The Item property returns a single Attachment object from the Attachments collection. Read-only.

Syntax

collAttachments.Item(index) 
 
index
Long. An integer ranging from 1 to collAttachments.Count.

The Item property is the default property of an Attachments collection, meaning that collAttachments(index) is syntactically equivalent to collAttachments.Item(index) in Microsoft® Visual Basic® code.

Data Type

Object (Attachment)

Remarks

The Item property works like an accessor property for small collections.

The Item(index) syntax selects an arbitrary Attachment object within the Attachments collection.

Although the Item property itself is read-only, the Attachment object it returns can be accessed in the normal manner, and its properties retain their respective read/write or read-only accessibility.

Example

This code fragment shows the Count and Item properties working together to traverse the collection:

' from Util_SmallCollectionCount(collAttachments As Object) 
Dim strItemName(100) as String 
Dim i As Integer ' loop counter 
' error handling omitted from this fragment ... 
For i = 1 To collAttachments.Count Step 1 
    strItemName(i) = collAttachments.Item(i).Name 
    ' or = collAttachments(i) since Item and Name are default properties 
    If 100 = i Then ' max size of string array 
        Exit Function 
    End If 
Next i