Q:

How to tell which item was checked/unchecked in a listbox

How could I tell which item's state (checked/unchecked) was changed in a checkedlistbox?
I know how to trigger an event when an item's state was changed, but I don't know how to tell WHICH item. Any suggestions?
P.S. I'm using Visual Basic with .net 4.5

A:

The you want is reffered to by ItemCheckEventArgs.Index
Checkout http://msdn.microsoft.com/en-us/library/system.windows.forms.itemcheckeventargs.index.aspx
At the bottom:-
Private Sub ListView1_ItemCheck1(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.ItemCheckEventArgs) _
    Handles ListView1.ItemCheck

    If (e.CurrentValue = CheckState.Unchecked) Then
        price += Double.Parse( _
        Me.ListView1.Items(e.Index).SubItems(1).Text)
    ElseIf (e.CurrentValue = CheckState.Checked) Then
        price -= Double.Parse( _
            Me.ListView1.Items(e.Index).SubItems(1).Text)
    End If 

    ' Output the price to TextBox1.
    TextBox1.Text = CType(price, String)

End Sub

