ToolStripComboBox.FindString 方法

定义

查找以指定字符串开头的第一项 ToolStripComboBox

重载

名称 说明
FindString(String)

查找以指定字符串开头的第一项 ToolStripComboBox

FindString(String, Int32)

查找给定索引后的第一项,该索引以给定字符串开头。

FindString(String)

Source:
ToolStripComboBox.cs
Source:
ToolStripComboBox.cs
Source:
ToolStripComboBox.cs
Source:
ToolStripComboBox.cs
Source:
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)

Source:
ToolStripComboBox.cs
Source:
ToolStripComboBox.cs
Source:
ToolStripComboBox.cs
Source:
ToolStripComboBox.cs
Source:
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

适用于