System.Windows.Forms.ListView.FindItemWithText Method

Finds the first System.Windows.Forms.ListViewItem or System.Windows.Forms.ListViewItem.ListViewSubItem, if indicated, that begins with the specified text value. The search starts at the specified index.

Syntax

public ListViewItem FindItemWithText (string text, bool includeSubItemsInSearch, int startIndex, bool isPrefixSearch)

Parameters

text
The text to search for.
includeSubItemsInSearch
true to include subitems in the search; otherwise, false.
startIndex
The index of the item at which to start the search.
isPrefixSearch
true to allow partial matches; otherwise, false.

Returns

The first System.Windows.Forms.ListViewItem that begins with the specified text value.

Remarks

The erload:System.Windows.Forms.ListView.FindItemWithText method returns null if the list is empty or there is no matching item.

The search is case-insensitive.

The text parameter can specify a substring of the desired matching text. This method will return the first item that starts with the specified text, unless false is passed in for isPrefixSearch. For example, if a System.Windows.Forms.ListView contains two list items—the first item's text set to "angle bracket" and the second item's text set to "bracket"—a call to erload:System.Windows.Forms.ListView.FindItemWithText passing "brack" as the search text will return the item whose text is "bracket". If isPrefixSearch is set to false, this call will return null.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0