How to get the index number of the selected listview item
61,455
Solution 1
Dim index As Integer = ListView1.SelectedIndices(0)
remember indeces in VB.NET are 0-based.
Solution 2
Try this one:
Dim x as Integer
x = ListView1.FocusedItem.Index
To get the values:
Dim txtValue as String
txtValue = ListView1.FocusedItem.SubItems(0).text
Author by
SpongeBob SquarePants
Top Secret I live Deep down in the Pacific Ocean in the subterranean city of Bikini Bottom in a pineapple along with my pet Gary. I make delicious Krabby Patty Burger at Krusty Krabs. My favorite quote: Isn't this great Squidward? Its just the 3 of us. You, me, and this brick wall you built between us
Updated on June 06, 2020Comments
-
SpongeBob SquarePants almost 4 years
I have set these options on my listview
- multiSelect = false
- view = details
- FullRow select = true
- HideSelected = False.
I have one column which has 10 items. I want to get the selected row index in vb.net