Search code examples
vb.netsyntaxcheckedlistbox

How to Check if an Item in The CheckedListNox is Selected & Checked?


I want to be able to set up a condition statement that checks if an item in checkedlistbox is both selected (highlighted in blue) and checked

How do I achieve this?

Note: this should be something like, if(checkedlistbox.items.selected = true AND checkedlistbox.items.checked = true) then...


Solution

  • you could do something like this

    If CheckedListBox.CheckedIndices.Contains(CheckedListBox.SelectedIndex) then
        'whatever you want to do with CheckedListBox.items(CheckedListbox.SelectedIndex)
    End If