語言

ListView.SelectedListViewItemCollection.IndexOf(ListViewItem) 方法

定義

回傳指定項目集合內的索引。

public:
 int IndexOf(System::Windows::Forms::ListViewItem ^ item);
public int IndexOf(System.Windows.Forms.ListViewItem item);
member this.IndexOf : System.Windows.Forms.ListViewItem -> int
Public Function IndexOf (item As ListViewItem) As Integer

參數

item
ListViewItem

收藏中要找到的物品。

傳回

集合中項目的零基索引。 若該項目不在集合中,則回傳 -1。

備註

一旦你知道某個項目在選取的項目集合中(使用該 Contains 方法),你就可以用該 IndexOf 方法來判斷該項目在 ListView.SelectedListViewItemCollection.

適用於

另請參閱