ListViewItem.ListViewSubItemCollection.Item[] Property

Definition

Gets an item from the collection.

Overloads

Item[Int32]

Gets or sets the subitem at the specified index within the collection.

Item[String]

Gets an item with the specified key from the collection.

Item[Int32]

Source:
ListViewItem.ListViewSubItemCollection.cs
Source:
ListViewItem.ListViewSubItemCollection.cs
Source:
ListViewItem.ListViewSubItemCollection.cs

Gets or sets the subitem at the specified index within the collection.

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

Parameters

index
Int32

The index of the item in the collection to retrieve.

Property Value

A ListViewItem.ListViewSubItem representing the subitem 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 ListViewItem.ListViewSubItemCollection.

Remarks

You can use this method to obtain the ListViewItem.ListViewSubItem stored at a specific location in the collection. To determine the index of a specific item in the collection, use the IndexOf method.

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

Item[String]

Source:
ListViewItem.ListViewSubItemCollection.cs
Source:
ListViewItem.ListViewSubItemCollection.cs
Source:
ListViewItem.ListViewSubItemCollection.cs

Gets an item with the specified key from the collection.

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

Parameters

key
String

The name of the ListViewItem.ListViewSubItem to retrieve.

Property Value

The ListViewItem.ListViewSubItem with the specified key.

Remarks

The Name property corresponds to the key for a ListViewItem.ListViewSubItem in the ListViewItem.ListViewSubItemCollection.

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