语言

ListBox.SelectedIndexCollection.IndexOf(Int32) 方法

定义

从ListBox.SelectedIndexCollectionListBox.ObjectCollection指定的索引中ListBox返回索引中的索引。

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

要在此集合中找到的从零开始的索引 ListBox.ObjectCollection 。

返回

集合中指定索引所在的ListBox.ObjectCollection集合中从零开始的ListBox.SelectedIndexCollection索引;否则为负 1(-1)。

注解

知道项位于集合中(使用Contains该方法)后,可以使用IndexOf该方法来确定存储ListBox.ObjectCollection其中的特定索引位置ListBox的位置ListBox.SelectedIndexCollection。

适用于

另请参阅