I have a really simple question but unfortunately I can't answer it! I am trying to get the selected rows from a listview. To achieve this, I did this:
Dim numsel As Integer
numsel = Me.ListView1.Items.Count
For countme As Integer = 0 To numsel
If Me.ListView1.Items(countme).Selected = True Then
For subitem As Integer = 0 To 3
MessageBox.Show("hello!" & vbNewLine & Me.ListView1.Items(countme).SubItems(subitem).Text)
Next
End If
Next
It does count the selected rows, but it always throws out the error saying "ArgumentOutOfRange Exception", or something along those lines. For example, if I selected a row, it will output the results of that row. But the loop goes on. I tried everything I can but to no avail. I specifically want to select multiple rows, and I can achieve that if someone can assist me with this simple "problem" I have.
I will be so grateful for anyone who will help me. Have a nice day!

New Topic/Question
Reply




MultiQuote




|