How to: Select an Item in the Windows Forms ListView Control
This example demonstrates how to programmatically select an item in a Windows Forms ListView control. Selecting an item programmatically does not automatically change the focus to the ListView control. For this reason, you will typically also want to set the item as focused when selecting an item.
Example
this.listView1.Items[0].Focused = true;
this.listView1.Items[0].Selected = true;
me.ListView1.Items(0).Focused = True
me.ListView1.Items(0).Selected = True
Compiling the Code
This example requires:
A ListView control named
listView1
that contains at least one item.References to the System and System.Windows.Forms namespaces.
See also
Dolgozzon együtt velünk a GitHubon
A tartalom forrása a GitHubon található, ahol létrehozhat és áttekinthet problémákat és lekéréses kérelmeket is. További információért tekintse meg a közreműködői útmutatónkat.
.NET Desktop feedback