How to check the item in a checkedlistbox control in code?

  • Thread starter Thread starter Cylix
  • Start date Start date
C

Cylix

When I using the checkedlistbox1.items.add, I found that it can be set
the item is checked defaultly.
But how can I using the code to check an item in the list after
defined the list??

Thanks.
 
Cylix,

Get the index of the item & then you can control it

Here's an example:

Create a new Windows Application
Add a CheckedListBox control

Form Load even:

With CheckedListBox1
.Items.Add("Tom")
.Items.Add("Dick")
.Items.Add("Harry")
End With

----------------

I put this behind a button for testing:

Dim i As Integer = CheckedListBox1.FindString("Dick")
CheckedListBox1.SetItemChecked(i, True)
 
Back
Top