อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


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]

Source:
ListView.ListViewItemCollection.cs
Source:
ListView.ListViewItemCollection.cs
Source:
ListView.ListViewItemCollection.cs

Retrieves the item with the specified key.

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

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

.NET Framework 4.8.1 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.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.ListViewItemCollection.cs
Source:
ListView.ListViewItemCollection.cs
Source:
ListView.ListViewItemCollection.cs

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

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

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

.NET Framework 4.8.1 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.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