Pregunta

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?

¿Fue útil?

Solución

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top