Question : how do I remove a selected row from a listview

I am trying to remove a selected row from a listview via a button and have developed the attached code but keep getting the following error message
InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index
1:
2:
3:
4:
Dim idx As Integer
        idx = lvMatchedDvid.SelectedItems(lvMatchedDvid.Items.Count - 1).Index

        lvMatchedDvid.Items.RemoveAt(idx)

Answer : how do I remove a selected row from a listview

Hi there

Try the following:
Dim item As ListViewItem
        For Each item In lvMatchedDvid.SelectedItems
            item.Remove()
        Next
Random Solutions  
 
programming4us programming4us