Edit

Share via


ListView.ListViewItemCollection.Item[] Property

Definition

Gets or sets an item in the collection.

Overloads

Item[String]

Retrieves the item with the specified key.

Item[Int32]

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

Item[String]

Retrieves the item with the specified key.

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; }
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.

Property Value

The ListViewItem whose Name property matches the specified key.

Remarks

The key comparison is not case-sensitive. The Name property corresponds to the key for a ListViewItem in the ListView.ListViewItemCollection.

Applies to

Item[Int32]

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

public:
 virtual property System::Windows::Forms::ListViewItem ^ default[int] { System::Windows::Forms::ListViewItem ^ get(int displayIndex); void set(int displayIndex, System::Windows::Forms::ListViewItem ^ value); };
public:
 virtual property System::Windows::Forms::ListViewItem ^ default[int] { System::Windows::Forms::ListViewItem ^ get(int index); void set(int index, System::Windows::Forms::ListViewItem ^ value); };
public virtual System.Windows.Forms.ListViewItem this[int displayIndex] { get; set; }
public virtual System.Windows.Forms.ListViewItem this[int index] { get; set; }
member this.Item(int) : System.Windows.Forms.ListViewItem with get, set
Default Public Overridable Property Item(displayIndex As Integer) As ListViewItem
Default Public Overridable Property Item(index As Integer) As ListViewItem

Parameters

displayIndexindex
Int32

The index of the item in the collection to get or set.

Property Value

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

Exceptions

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

Remarks

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

See also

Applies to