語言

ListView.SelectedIndexCollection.IndexOf(Int32) 方法

定義

public:
 int IndexOf(int selectedIndex);
public int IndexOf(int selectedIndex);
member this.IndexOf : int -> int
Public Function IndexOf (selectedIndex As Integer) As Integer

參數

selectedIndex
Int32

從 ListView.ListViewItemCollection 到 在集合中尋找的以零為基礎的索引。

傳回

集合中指定的索引ListView.ListViewItemCollectionListView.SelectedIndexCollection位於集合中,若索引位於集合中,則為 -1 索引。

備註

一旦你確定某個項目在所選索引集合中(使用該 Contains 方法),你就可以用該 IndexOf 方法來判斷該索引在 ListView.SelectedIndexCollection中的位置。

適用於

另請參閱