Public Function SelectFromDatabase(ByVal SelectStatement As String) As DataTable
Dim Dt As New DataTable()
Dim SQLDA As New SqlClient.SqlDataAdapter(SelectStatement, "ConnectionString")
SQLDA.Fill(Dt)
Return Dt
End Function
Dim dtPersons As DataTable
dtPersons = SelectFromDatabase("select firstname, lastname, Groupnumber from Table WHERE Groupnumber = '" & TextBox1.Text.Trim & "'")
For Each dRow As DataRow In dtPersons.Rows
CheckedListBox1.Items.Add(dRow.Item("Firstname"))
Next