Checked List Box Help

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) ?
 
C

c_shah

For Each Item As Object In CheckedListBox1.CheckedItems
MsgBox(CheckedListBox1.GetItemText(Item))
Next
 
C

c_shah

For Each Item As Object In CheckedListBox1.CheckedItems
MsgBox(CheckedListBox1.GetItemText(Item))
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top