Export (0) Print
Expand All

ListView.SelectedIndexCollection.IndexOf Method

Returns the index within the ListView.SelectedIndexCollection of the specified index from the ListView.ListViewItemCollection of the list view control.

[Visual Basic]
Public Function IndexOf( _
   ByVal selectedIndex As Integer _
) As Integer
[C#]
public int IndexOf(
 int selectedIndex
);
[C++]
public: int IndexOf(
 int selectedIndex
);
[JScript]
public function IndexOf(
   selectedIndex : int
) : int;

Parameters

selectedIndex
The zero-based index from the ListView.ListViewItemCollection to locate in the collection.

Return Value

The zero-based index in the collection where the specified index of the ListView.ListViewItemCollection is located within the ListView.SelectedIndexCollection. If the index is not located in the collection, the return value is negative one (-1).

Remarks

Once you know that an item is in the selected index collection (using the Contains method), you can use the IndexOf method to determine the position of the index in the ListView.SelectedIndexCollection.

Requirements

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

ListView.SelectedIndexCollection Class | ListView.SelectedIndexCollection Members | System.Windows.Forms Namespace | Contains

Show:
© 2014 Microsoft