ListBox.SelectedIndexCollection.IndexOf(Int32) 方法

定义

返回指定索引的 ListBox.SelectedIndexCollection 内的索引,该指定索引来自 ListBox.ObjectCollectionListBoxReturns the index within the ListBox.SelectedIndexCollection of the specified index from the ListBox.ObjectCollection of the 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 的从零开始的索引。The zero-based index from the ListBox.ObjectCollection to locate in this collection.

返回

该集合中从零开始的索引,ListBox.ObjectCollection 的指定索引位于 ListBox.SelectedIndexCollection 内的该处;否则为负一 (-1)。The zero-based index in the collection where the specified index of the ListBox.ObjectCollection was located within the ListBox.SelectedIndexCollection; otherwise, negative one (-1).

注解

一旦知道某个项位于集合内(使用 @no__t 0 方法),就可以使用 IndexOf 方法来确定 @no__t 的 ListBox.ObjectCollection 中的特定索引位置存储在 @no__t 中的哪个位置。Once you know that an item is located within the collection (using the Contains method), you can use the IndexOf method to determine where a specific index position within the ListBox.ObjectCollection for the ListBox is stored within the ListBox.SelectedIndexCollection.

适用于

另请参阅