Q: How to get a list of checked item from Check List VB. Net Winform After several hours of trying, I was able to get a Check List binded to SQL source. However, now I would like to retrieve all of the items in the check list that are checked. I tried the above code but it does not work
 For i As Integer = 0 To checkList_Facility.Items.Count - 1
        If (checkList_Facility.GetItemChecked(i)) = True Then
            MsgBox(checkList_Facility.Items(i))
        End If
    Next

Binding Code:
            Dim queryString As String = "SELECT Facility FROM Database.dbo.Facility"
        Dim connection As New SqlConnection(connectionString)
        Dim command As New SqlCommand(queryString, connection)
        connection.Open()
        Dim dataReader As SqlDataReader = command.ExecuteReader()
        Dim var As New DataTable
        Dim source As New BindingSource
        source.DataSource = dataReader
        CheckList_Facility.DataSource = source
        CheckList_Facility.ValueMember = "Facility"
        connection.Close()


A: How about using CheckedItems collection instead?
EDIT:
dim itemChecked as Object
For Each itemChecked In checkList_Facility.CheckedItems
   MsgBox(itemChecked.ToString())
Next


A: CheckedItems seems to be a good option. Here is how it works. For simplicity, suppose your underlying business object (DataSource) is a Dictionary(Of String, String):
Dim dict As New Dictionary(Of String, String)
With dict
  .Add("1", "One")
  .Add("2", "Two")
  .Add("3", "Three")
End With

And you have the following binding:
With CheckedListBox1
  .DataSource = dict.ToList
  .ValueMember = "Key"
  .DisplayMember = "Value"
End With

It seems that Microsoft do not want us to use this approach, probably due to compatibility issues. You know this because .DataSource and other members are hidden in intellisense. However, for simple setup such as the above, it works, just don't rely on intellisense in typing these members.
Now let's say you have a button with the following code in it:
Dim v = CheckedListBox1.CheckedItems

In this case v is a collection of underlying business objects, for the above it will be collection of KeyValuePair(Of String, String).
In your case your business object is of type DataRecordInternal, so you have to expect this type to be returned and account for it in code. Note that it may not have a good behavior of ToString(), so this will not work as you expect it:
MsgBox(checkList_Facility.Items(i))

I believe you are looking to do some processing instead, messaging a user about every checked item is not very useful. So instead you may want to have a different code, such as:
Dim record As DataRecordInternal = checkList_Facility.Items(i)
'do some processing on record variable

