ListView.ListViewItemCollection.Find(String, Boolean) 方法

定义

搜索名称与指定键匹配的项,也可以选择搜索子项。Searches for items whose name matches the specified key, optionally searching subitems.

public:
 cli::array <System::Windows::Forms::ListViewItem ^> ^ Find(System::String ^ key, bool searchAllSubItems);
public System.Windows.Forms.ListViewItem[] Find (string key, bool searchAllSubItems);
member this.Find : string * bool -> System.Windows.Forms.ListViewItem[]
Public Function Find (key As String, searchAllSubItems As Boolean) As ListViewItem()

参数

key
String

要搜索的项名称。The item name to search for.

searchAllSubItems
Boolean

若要搜索子项,则为 true;否则为 falsetrue to search subitems; otherwise, false.

返回

包含匹配项的 ListViewItem 对象的数组;如果没有匹配项,则为一个空数组。An array of ListViewItem objects containing the matching items, or an empty array if no items matched.

注解

密钥比较不区分大小写。The key comparison is not case-sensitive. Name 属性对应于 ListView.ListViewItemCollectionListViewItem 的键。The Name property corresponds to the key for a ListViewItem in the ListView.ListViewItemCollection.

适用于