ListBox.SelectedIndexCollection.IndexOf(Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从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。