I need to know what is the type of every element in CheckedListBox.Items? Is it ListViewItem, Object or what?
I also want to know how can I bind a DataTable to a CheckedListBox and set every items ID and text in windows forms?
I need to know what is the type of every element in CheckedListBox.Items? Is it ListViewItem, Object or what?
I also want to know how can I bind a DataTable to a CheckedListBox and set every items ID and text in windows forms?
On
The accepted answer didn't work for me; the state never changed. This is the code that I came up with that does work.
Private Sub SetCLBXState(ByVal DesiredState As Boolean)
For ItemIndex As Integer = 0 To CLBXExclude.Items.Count - 1
CLBXExclude.SetItemChecked(ItemIndex, DesiredState)
Next
End Sub
The type depends on the objects that you use to fill the checked list box. You can use a
DataTableby using the following code:In this case since you will be filling the checked list box using a
DataTabledoingthis.checkedListBox1.CheckedItemsafter checking one or more items will output anObjectCollectionwhere each item in the collection is aDataRowViewinstance.To obtain the checked items you could do: