CheckedListBox
Sample Code
Add Object to CheckedListBox
Dim pItem As CarItem
pItem = New CarItem()
pItem.CarId = 1
pItem.CarName="CarName"
' 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
Next
Set all item checked
For i As Integer = 0 To Me.CheckedListBox.Items.Count-1
Me.CheckedListBox.SetItemChecked(i, true)
Next i
7 comments:
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.
Is there any way of ensuring that only 1 item is checked in the CheckedListBox?
Thanks!
Mechi
Yes.
This is sample code.
If CheckedListBox1.CheckedItems.Count= 1Then
MessageBox.Show("Checked one item")
End If
Is there a way to get the ID of the items checked rather than the name?
I'm looking forward to getting more information about this topic, don't worry about negative opinions.
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
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
Post a Comment