Question

In Visual Studio whenever you select an item, the item become highlighted. I want to take advantage of this property to retrieve the checked item that is currently being highlighted (out of all the item in the checkedlistbox)

Is this operation possible?

Was it helpful?

Solution

The CheckedListBox control always seemed rather half-baked to me, so I don't use it often.

Something like this works:

With CheckedListBox1
  If .SelectedIndex > -1 Then
    If .CheckedIndices.Contains(.SelectedIndex) Then
      MessageBox.Show(.SelectedItem.ToString & " is checked.")
    Else
      MessageBox.Show(.SelectedItem.ToString & " is not checked.")
    End If
  End If
End With
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top