Вопрос

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?

Это было полезно?

Решение

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top