Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all,

I need help with using the ListView.ItemChecked event.
In a procedure (triggered by the ItemChecked event), I need to extract a data from the record that is checked.

The lvDetail.ItemChecked event appears to run the test I wrote for each line when adding all the records within the lvDetail control.

Can anyone help me?

Thanks
Marcello

What I have tried:

VB
Private Sub lvDetail_ItemChecked(sender As Object, e As ItemCheckedEventArgs) Handles lvDetail.ItemChecked
        If e.Item.Checked Then
            MsgBox("Selected: " & e.Item.SubItems(4).Text)
        Else
            MsgBox("Deselected: " & e.Item.SubItems(4).Text)
        End If
    End Sub
Posted
Updated 4-May-18 9:54am
v2
Comments
Maciej Los 4-May-18 15:46pm    
How do you bind data to ListView?
Semola73 4-May-18 15:54pm    
I add single row in a for each statement (I have removed some lines for code reading):
I also tried to add a removehandler/addhendler without success.

lvFilmDetail.BeginUpdate()

For Each ws_film In ws_elenco_film
Dim item As New ListViewItem(ws_film.Get_Titolo)

item.SubItems.Add(ws_film.Get_Id_tmdb)

lvFilmDetail.Items.Add(item)
Next

lvFilmDetail.EndUpdate()

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900