Type | Description | |||
key as Long | A long expression that indicates the index of the definition in the collection. The collection is 0 based. | |||
Definition | A Definition object that holds the definition. |
The Count property counts the number of the definitions in the collection. Use the Definitions property to access the Definitions collection. The Item property of the Definitions collection is the default property for the Definitions object so the following statements are equivalents:
Definitions.Item(i)
or
Definitions(i)
The following sample displays all "exact" definitions for "cat" using the Item property:
Private Sub Form_Load() Dim c As EXDICTCLIENTLibCtl.Connection Set c = Client1.OpenConnection("dict.org") If Not (c Is Nothing) Then With c.CreateQuery("catalog", , c.Strategies("exact")) Dim r As EXDICTCLIENTLibCtl.IResult For Each r In .Execute Debug.Print " Searching the '" & r.Word & "' in '" & r.Dictionary.Name & "' dictionary gets: " Dim d As EXDICTCLIENTLibCtl.IDefinition Dim i As Long For i = 0 To r.Definitions.Count - 1 Set d = r.Definitions.Item(i) Debug.Print d.Body Next Next End With c.Close End If Set c = Nothing End Sub
The following sample does the same thing as previous except that enumerating the definitions in the Definitions collection is did using the for each statement:
Private Sub Form_Load() Dim c As EXDICTCLIENTLibCtl.Connection Set c = Client1.OpenConnection("dict.org") If Not (c Is Nothing) Then With c.CreateQuery("dog", , c.Strategies("exact")) Dim r As EXDICTCLIENTLibCtl.IResult For Each r In .Execute Debug.Print " Searching the '" & r.Word & "' in '" & r.Dictionary.Name & "' dictionary gets: " Dim d As EXDICTCLIENTLibCtl.IDefinition For Each d In r.Definitions Debug.Print d.Body Next Next End With c.Close End If Set c = Nothing End Sub