README.md
December 5, 2022 · View on GitHub
Description
This simple code will allow you to programmatically select an item in a listview. Hope this helps.
More Info
| Submitted On | |
| By | Jason Heine |
| Level | Beginner |
| User Rating | 4.7 (203 globes from 43 users) |
| Compatibility | VB.NET |
| Category | Controls/ Forms/ Dialogs/ Menus |
| World | .Net (C#, VB.net) |
| Archive File |
Source Code
How to select a ListView Item Programmatically.
This is a simple process, but most people forget a little step in doing this.
Step 1:
Create a ListView Item and name it to whatever you wish. I will use lv for simplicity.
Step 2:
Create a Button Item
Step 3:
Double Click the Button to start typeing code.
Step 4:
Enter the following code:
Private Sub Button1_Click(......) Handles Button1.Click
lv.Items(0).Selected = True
lv.Select() 'This is what most people forget. If you don't put this in here, it will never select the item in the list view.
End Sub
And that is it! Really Really simple, but very useful.
Step 5:
If you find this code useful. Vote for me.