ListBox.ObjectCollection.IndexOf(Object) 方法

定義

傳回指定項目集合中的索引。Returns the index within the collection of the specified item.

public:
 virtual int IndexOf(System::Object ^ value);
public int IndexOf (object value);
abstract member IndexOf : obj -> int
override this.IndexOf : obj -> int
Public Function IndexOf (value As Object) As Integer

參數

value
Object

表示位於集合中項目的物件。An object representing the item to locate in the collection.

傳回

以零起始的索引,是集合中項目的位置,否則為負一 (-1)。The zero-based index where the item is located within the collection; otherwise, negative one (-1).

實作

例外狀況

value 參數為 null。The value parameter is null.

備註

IndexOf 方法可讓您判斷專案在集合中的所在位置。The IndexOf method enables you to determine where an item is located within the collection. 若要判斷專案是否位於集合中,然後再呼叫這個方法,請使用 Contains 方法。To determine whether an item is located within the collection before calling this method, use the Contains method.

適用於

另請參閱