Finds and returns a reference to a ListItem object in a ListView control.
object.FindItem (string, value, index, match)
The parts of the FindItem statement syntax are described in the following table.
Part | Description |
---|---|
object | Required. An object expression that evaluates to a ListView control. |
string | Required. A string expression indicating the ListItem object to be found. |
value | Optional. An integer or constant specifying whether the string will be matched to the ListItem object's Text or SubItems property, as described in Settings. |
index | Optional. An integer or string that uniquely identifies a member of an object collection and specifies the location from which to begin the search. The integer is the value of the Index property; the string is the value of the Key property. If no index is specified, the default is 1. |
match | Optional. An integer or constant specifying that a match will occur if the item's Text property is the same as the string, as described in Settings. |
The settings for value are described in the following table.
Value | Description |
---|---|
0 | (Default) Matches the string with a ListItem object's Text property. |
1 | Matches the string with any string in a ListItem object's SubItems property. |
The settings for match are described in the following table.
Value | Description |
---|---|
0 | (Default) An integer or constant specifying that a match will occur if the item's Text property begins with the whole word being searched. Ignored if the criteria is not text. |
1 | An integer or constant specifying that a match will occur if the item's Text property begins with the string being searched. Ignored if the criteria is not text. |
If you specify Text as the search criteria, you can set the value to 1, so that a match occurs when the ListItem object's Text property begins with the string you are searching for.