Checked List Box Help

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

I am doing something wrong...

I am populating a Checked List box from a stored proc...

CheckedListBox1.DataSource=dsStates.Tables("States")
CheckedListBox1.DisplayMember = "State"
CheckedListBox1.DisplayMember = "State"
"State" is the column in the table...

And the above works fine... All the states are shown in the CheckedListBox


I then want to loop thru to find the ones that were checked (process is
invoked from a button)...

Dim i as integer

For i=0 to CheckedListBox1.Items.Count -1
If CheckedListBox1.GetItemChecked(i)= true then
Msgbox ("Checked: " & CheckedListBox1.GetItemText(i))
End if
Next

The above code will give me the integer associated with the row number, but
how do I return the value of the rows contents (i.e., FL) ?
 
For Each Item As Object In CheckedListBox1.CheckedItems
MsgBox(CheckedListBox1.GetItemText(Item))
Next
 
For Each Item As Object In CheckedListBox1.CheckedItems
MsgBox(CheckedListBox1.GetItemText(Item))
Next
 
Back
Top