语言

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.ListViewItemCollection的集合中从零开始的索引ListView.SelectedIndexCollection;如果索引不在集合中,则为 -1。

注解

一旦知道某个项位于所选索引集合中(使用 Contains 该方法),就可以使用 IndexOf 该方法来确定索引在索引 ListView.SelectedIndexCollection中的位置。

适用于

另请参阅