Sample Code

Add Object to CheckedListBox

Dim pItem As CarItem

pItem = New CarItem()
pItem.CarId = 1

' Add this object to CheckListBox
' And CheckListBox show CarName because I override toString function
Me.CheckListBox1.Items.Add(pItem, True)

' Class CarItem

Private Class CarItem

Public CarId As Integer
Public CarName As String

Public Sub New()

End Sub

' Override tostring
Public Overrides Function ToString() As String
Return CarName
End Function

End Class

Get status items in CheckedListBox

For i As Integer = 0 To Me.CheckedListBox.Items.Count - 1
If Me.CheckedListBox.GetItemChecked(i) Then
'TODO Something

End If
Next i

Get only Checked Items

For i As Integer = 0 To Me.CheckedListBox.CheckedItems.Count - 1
'TODO Something

Set all item checked

For i As Integer = 0 To Me.CheckedListBox.Items.Count-1
Me.CheckedListBox.SetItemChecked(i, true)

Next i


Multifuncional said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Impressora e Multifuncional, I hope you enjoy. The address is http://impressora-multifuncional.blogspot.com. A hug.

Mechi said...

Is there any way of ensuring that only 1 item is checked in the CheckedListBox?

TOM said...

This is sample code.

If CheckedListBox1.CheckedItems.Count= 1Then
MessageBox.Show("Checked one item")
End If

Anonymous said...

Is there a way to get the ID of the items checked rather than the name?

Anonymous said...

I'm looking forward to getting more information about this topic, don't worry about negative opinions.

Anonymous said...

is there any way to move checked list box item to list box by clicking a button and also have to move only selected items

Anonymous said...

If you are looking for basically is a perfect opportunity
to steal personal information, such as managing our
finances online, not knowing that there is
a malicious Keylogger program.

Here is my homepage keyloggers