語言

ToolStripComboBox.FindString 方法

定義

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

多載

名稱 Description
FindString(String)

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

FindString(String, Int32)

尋找以該字串開頭的索引後的第一個項目。

FindString(String)

來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs

找到第一個以指定字串開頭的項目 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)

來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs
來源:
ToolStripComboBox.cs

尋找以該字串開頭的索引後的第一個項目。

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 方法。

適用於