ToolStripComboBox.FindString 方法

定義

尋找 ToolStripComboBox 中第一個以指定字串為開頭的項目。

多載

FindString(String)

尋找 ToolStripComboBox 中第一個以指定字串為開頭的項目。

FindString(String, Int32)

尋找在指定索引之後第一個以指定字串開始的項目。

FindString(String)

尋找 ToolStripComboBox 中第一個以指定字串為開頭的項目。

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

參數

s
String

要搜尋的 String

傳回

找到第一個項目之以零為起始的索引,如果沒有找到符合的,則傳回 -1。

備註

此方法執行的搜尋不會區分大小寫。 參數 s 是子字串,可與下拉式方塊清單中的專案相關聯的文字進行比較。 搜尋會從文字開頭開始執行部分比對,並傳回清單中符合指定子字串的第一個專案。 然後,您可以執行工作,例如移除包含搜尋文字的專案,或變更專案的文字。 找到指定的文字之後,如果您想要在 中 ToolStripComboBox 搜尋其他文字範例,請使用 FindString 方法在 內 ToolStripComboBox 指定起始索引。 如果您想要執行搜尋完全字組比對,而不是部分相符專案,請使用 FindStringExact 方法。

適用於

FindString(String, Int32)

尋找在指定索引之後第一個以指定字串開始的項目。

public:
 int FindString(System::String ^ s, int startIndex);
public int FindString (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

要搜尋的 String

startIndex
Int32

搜尋第一個項目之前,項目以零為起始的索引。 設定為 -1 以便從控制項的開頭進行搜尋。

傳回

找到第一個項目之以零為起始的索引,如果沒有找到符合的,則傳回 -1。

備註

此方法執行的搜尋不會區分大小寫。 參數 s 是子字串,可與下拉式方塊清單中的專案相關聯的文字進行比較。 搜尋會從指定索引處的文字開頭開始執行部分比對,並傳回清單中符合指定子字串的第一個專案。 然後,您可以執行工作,例如移除包含搜尋文字的專案,或變更專案的文字。 找到指定的文字之後,如果您想要在 中 ToolStripComboBox 搜尋其他文字範例,請使用這個方法在 內 ToolStripComboBox 指定起始索引。 如果您想要執行搜尋完全字組比對,而不是部分相符專案,請使用 FindStringExact 方法。

適用於