ListView.SelectedListViewItemCollection.Item[] Property

Definition

Gets an item from the collection.

Overloads

Item[String]

Gets an item with the specified key from the collection.

Item[Int32]

Gets the item at the specified index within the collection.

Item[String]

Source:
ListView.SelectedListViewItemCollection.cs
Source:
ListView.SelectedListViewItemCollection.cs
Source:
ListView.SelectedListViewItemCollection.cs

Gets an item with the specified key from the collection.

C#
public virtual System.Windows.Forms.ListViewItem this[string key] { get; }

Parameters

key
String

The name of the item to retrieve from the collection.

Property Value

The ListViewItem with the specified key.

Remarks

The Name property corresponds to the key for a ListViewItem in the ListView.SelectedListViewItemCollection.

The key comparison is not case-sensitive. If the key parameter is null or an empty string, Item[] returns null.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Item[Int32]

Source:
ListView.SelectedListViewItemCollection.cs
Source:
ListView.SelectedListViewItemCollection.cs
Source:
ListView.SelectedListViewItemCollection.cs

Gets the item at the specified index within the collection.

C#
public System.Windows.Forms.ListViewItem this[int index] { get; }

Parameters

index
Int32

The index of the item in the collection to retrieve.

Property Value

A ListViewItem representing the item located at the specified index within the collection.

Exceptions

The index parameter is less than zero or greater than or equal to the value of the Count property of the ListView.SelectedListViewItemCollection.

Remarks

This indexer enables you to get a specific item from the ListView.SelectedListViewItemCollection. The item stored in the collection is an item in the ListView.ListViewItemCollection of the ListView that represents a selected item in the ListView.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10