This documentation is archived and is not being maintained.

ListView.FindItemWithText Method (String, Boolean, Int32, Boolean)

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

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public ListViewItem FindItemWithText (
	string text,
	bool includeSubItemsInSearch,
	int startIndex,
	bool isPrefixSearch
public ListViewItem FindItemWithText (
	String text, 
	boolean includeSubItemsInSearch, 
	int startIndex, 
	boolean isPrefixSearch
public function FindItemWithText (
	text : String, 
	includeSubItemsInSearch : boolean, 
	startIndex : int, 
	isPrefixSearch : boolean
) : ListViewItem
Not applicable.



The text to search for.


true to include subitems in the search; otherwise, false.


The index of the item at which to start the search.


true to match the search text to the prefix of an item; otherwise, false.

Return Value

The first ListViewItem that begins with the specified text value.

Exception typeCondition


startIndex is less 0 or more than the number of items in the ListView.

The FindItemWithText method returns a null reference (Nothing in Visual Basic) 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 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 search text will return the item whose text is "bracket". If isPrefixSearch is set to false, this call will return a null reference (Nothing in Visual Basic).

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0