This documentation is archived and is not being maintained.

ListViewItem.ListViewSubItemCollection.IndexOf Method

Returns the index within the collection of the specified subitem.

[Visual Basic]
Public Function IndexOf( _
   ByVal subItem As ListViewItem.ListViewSubItem _
) As Integer
public int IndexOf(
 ListViewItem.ListViewSubItem subItem
public: int IndexOf(
 ListViewItem.ListViewSubItem* subItem
public function IndexOf(
   subItem : ListViewItem.ListViewSubItem
) : int;


A ListViewItem.ListViewSubItem representing the subitem to locate in the collection.

Return Value

The zero-based index of the subitem's location in the collection. If the subitem is not located in the collection, the return value is negative one (-1).


The IndexOf method enables you to determine the position of a subitem in the collection. To determine whether a subitem is contained in the collection before calling this method, use the Contains method.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

ListViewItem.ListViewSubItemCollection Class | ListViewItem.ListViewSubItemCollection Members | System.Windows.Forms Namespace | Contains