ListViewItem.ListViewSubItemCollection.IndexOf 方法

定義

傳回指定子項目集合中的索引。

public:
 int IndexOf(System::Windows::Forms::ListViewItem::ListViewSubItem ^ subItem);
public int IndexOf (System.Windows.Forms.ListViewItem.ListViewSubItem subItem);
public int IndexOf (System.Windows.Forms.ListViewItem.ListViewSubItem? subItem);
member this.IndexOf : System.Windows.Forms.ListViewItem.ListViewSubItem -> int
Public Function IndexOf (subItem As ListViewItem.ListViewSubItem) As Integer

參數

subItem
ListViewItem.ListViewSubItem

ListViewItem.ListViewSubItem,表示位於集合中的子項目。

傳回

集合中子項目位置之以零起始的索引。 如果子項目不在集合中,則傳回值為負值 (-1)。

備註

方法 IndexOf 可讓您判斷子專案在集合中的位置。 若要判斷子專案是否包含在集合中,再呼叫這個方法,請使用 Contains 方法。

適用於

另請參閱