Bewerken

Share via


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]

Gets an item with the specified key from the collection.

public:
 virtual property System::Windows::Forms::ListViewItem ^ default[System::String ^] { System::Windows::Forms::ListViewItem ^ get(System::String ^ key); };
public virtual System.Windows.Forms.ListViewItem this[string key] { get; }
member this.Item(string) : System.Windows.Forms.ListViewItem
Default Public Overridable ReadOnly Property Item(key As String) As ListViewItem

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

Item[Int32]

Gets the item at the specified index within the collection.

public:
 property System::Windows::Forms::ListViewItem ^ default[int] { System::Windows::Forms::ListViewItem ^ get(int index); };
public System.Windows.Forms.ListViewItem this[int index] { get; }
member this.Item(int) : System.Windows.Forms.ListViewItem
Default Public ReadOnly Property Item(index As Integer) As ListViewItem

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