Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've created a small application to with a list view with checkboxes. I need to execute a function everytime an item is checked. I used the check item event and when I click the check box of the Item it fires up the check item event before the item is checked and put into the checked items collection in the list view, it simply acts like the click event. When I uncheck the item it will fire up the check item event but that time it will add the clicked item into the list view's checked items list but on the interface the item is unchecked. What's going on?
Please help!!!!
Posted

1 solution

I think you're referring to the Windows Forms CheckedListBox control - be more specific in your queries

Use the ItemCheck event. the argument 'e' will have all the required info like the item number, current value & previous value when clicked.
Here's an example event handler


VB
Private Sub CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles CheckedListBox1.ItemCheck
    MsgBox("Check change on row : " & e.Index & vbNewLine & _
           "Current State : " & e.CurrentValue.ToString() & vbNewLine & _
           "New State after click : " & e.NewValue.ToString())
End Sub
 
Share this answer
 

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