ToolStripComboBox.FindString 方法

定義

尋找 ToolStripComboBox 中第一個以指定字串為開頭的項目。Finds the first item in the ToolStripComboBox that starts with the specified string.

多載

FindString(String)

尋找 ToolStripComboBox 中第一個以指定字串為開頭的項目。Finds the first item in the ToolStripComboBox that starts with the specified string.

FindString(String, Int32)

尋找在指定索引之後第一個以指定字串開始的項目。Finds the first item after the given index which starts with the given string.

FindString(String)

尋找 ToolStripComboBox 中第一個以指定字串為開頭的項目。Finds the first item in the ToolStripComboBox that starts with the specified string.

public:
 int FindString(System::String ^ s);
public int FindString (string s);
member this.FindString : string -> int
Public Function FindString (s As String) As Integer

參數

s
String

要搜尋的 StringThe String to search for.

傳回

找到第一個項目之以零為起始的索引,如果沒有找到符合的,則傳回 -1。The zero-based index of the first item found; returns -1 if no match is found.

備註

這個方法所執行的搜尋不區分大小寫。The search performed by this method is not case-sensitive. s 參數是要與下拉式方塊清單中的專案相關聯的文字進行比對的子字串。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, and 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 or changing the item's text. 找到指定的文字之後,如果您想要搜尋 ToolStripComboBox中的其他文字範例,請使用 FindString 方法來指定 ToolStripComboBox內的起始索引。Once you have found the specified text, if you want to search for other instances of the text in the ToolStripComboBox, use FindString method to specify a starting index within the ToolStripComboBox. 如果您想要搜尋完全相符的單字,而不是部分相符,請使用 FindStringExact 方法。If you want to perform a search for an exact word match instead of a partial match, use the FindStringExact method.

FindString(String, Int32)

尋找在指定索引之後第一個以指定字串開始的項目。Finds the first item after the given index which starts with the given string.

public:
 int FindString(System::String ^ s, int startIndex);
public int FindString (string s, int startIndex);
member this.FindString : string * int -> int
Public Function FindString (s As String, startIndex As Integer) As Integer

參數

s
String

要搜尋的 StringThe String to search for.

startIndex
Int32

搜尋第一個項目之前,項目以零為起始的索引。The zero-based index of the item before the first item to be searched. 設定為 -1 以便從控制項的開頭進行搜尋。Set to -1 to search from the beginning of the control.

傳回

找到第一個項目之以零為起始的索引,如果沒有找到符合的,則傳回 -1。The zero-based index of the first item found; returns -1 if no match is found.

備註

這個方法所執行的搜尋不區分大小寫。The search performed by this method is not case-sensitive. s 參數是要與下拉式方塊清單中的專案相關聯的文字進行比對的子字串。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 at the specified index, and returns 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 or changing the item's text. 找到指定的文字之後,如果您想要搜尋 ToolStripComboBox中的其他文字範例,請使用這個方法來指定 ToolStripComboBox內的起始索引。Once you have found the specified text, if you want to search for other instances of the text in the ToolStripComboBox, use this method to specify a starting index within the ToolStripComboBox. 如果您想要搜尋完全相符的單字,而不是部分相符,請使用 FindStringExact 方法。If you want to perform a search for an exact word match instead of a partial match, use the FindStringExact method.

適用於