System.Windows.Forms.ListBox.FindStringExact Method

Finds the first item in the System.Windows.Forms.ListBox that exactly matches the specified string.

Syntax

public int FindStringExact (string s)

Parameters

s
The text to search for.

Returns

The zero-based index of the first item found; returns ListBox.NoMatches if no match is found.

Remarks

The search performed by this method is not case-sensitive. The search looks for an exact match to the words specified in the search string parameter, s. You can use this method to search for the first item that matches the specified string. You can then perform tasks such as removing the item that contains the search text by using the System.Windows.Forms.ListBox.ObjectCollection.Remove(object) method or changing the item's text. Once you have found the specified text, if you want to search for other instances of the text in the System.Windows.Forms.ListBox, you can use the version of the ListBox.FindStringExact(string) method that provides a parameter for specifying a starting index within the System.Windows.Forms.ListBox. If you want to perform partial word search instead of an exact word match, use the ListBox.FindString(string) method.

Requirements

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