Search code examples
vb.netlistviewcheckboxselected

listview checkbox selected vb.net


I have a listview with a checkbox on it but when I click the checkbox on the listview item, the item doesn't get selected. I want the listview item to be selected whenever I click the checkbox on the listview.


Solution

  • This will set the selected item to the row of your selected checkbox:

    Private Sub ListView1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck
         ListView1.Items(e.Index).Selected = True
    End Sub