Item Property (Patterns Collection)

The Item property returns the specified Pattern object from the Patterns collection. Read-only.

Syntax

objPatternsColl.Item(index)

index
A short integer ranging from 1 to objPatternsColl.Count.

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

Data Type

Pattern object

Remarks

The Item property works like an accessor property.

If the specified Pattern object is not found in the collection, the Item property returns Nothing.

Although the Item property itself is read-only, the Pattern 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:

' Put all pattern values in a collection into a string array 
Dim strItemValue(100) As String 
Dim i As Integer ' loop counter 
' error handling omitted from this fragment ... 
For i = 1 To objPatternsColl.Count Step 1 
    strItemValue(i) = objPatternsColl.Item(i).Value 
    ' or = objPatternsColl(i).Value since Item is default property 
    If 100 = i Then ' max size of string array 
        Exit Function 
    End If 
Next i