ListBox.SelectedIndexCollection.IndexOf(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
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