ListView::FindItemWithText Method (String^)
Finds the first ListViewItem that begins with the specified text value.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- text
-
Type:
System::String^
The text to search for.
Return Value
Type: System.Windows.Forms::ListViewItem^The first ListViewItem that begins with the specified text value.
The search is case-insensitive.
The text parameter can specify a substring of the desired matching text. In addition, this method will return the first item that starts with the specified text. For example, if a 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 FindItemWithText passing brack as the parameter will return the item whose text is "bracket".
The FindItemWithText method returns null if the list is empty or there is no matching item.
The following code example demonstrates the FindItemWithText method. To run this example, paste the following code into a Windows Form and call the InitializeFindListView method from the form's constructor or Load event handler. Click the button to see the results of the method call.
Available since 2.0