title: How to get a list of checked item from Check List VB. Net Winform
body: <p>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</p>
  
  <pre><code> 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
  </code></pre>
  
  <p>Binding Code:</p>
  
  <pre><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()
  </code></pre>