ComboBox.FindString Method (String, Int32)
Returns the index of the first item in the ComboBox beyond the specified index that contains the specified string. The search is not case sensitive.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
- Type: System.Int32
The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control.
The startIndex is less than -1.
The startIndex is greater than the last index in the collection.
The search performed by this method is not case-sensitive. The s parameter is a substring to compare against the text associated with the items in the combo box list. The search performs a partial match starting from the beginning of the text, returning the first item in the list that matches the specified substring. You can then perform tasks, such as removing the item that contains the search text using the Remove method or changing the item's text. This method is typically used after a call has been made using the version of this method that does not specify a starting index. Once an initial item has been found in the list, this method is typically used to find further instances of the search text by specifying the index position in the startIndex parameter of the item after the first found instance of the search text. If you want to perform a search for an exact word match instead of a partial match, use the FindStringExact method.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.