語言

ListBox.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

從 到 的位置為零的索引 ListBox.ObjectCollection 。

傳回

集合中以零為基礎的索引,其中指定的索引 ListBox.ObjectCollection 位於; ListBox.SelectedIndexCollection否則,為負一(-1)。

備註

一旦你知道某項目位於集合中(使用該Contains方法),你就可以利用該IndexOf方法判斷該項目在 中特定索引位置ListBox.ObjectCollectionListBox的位置。ListBox.SelectedIndexCollection

適用於

另請參閱