How to Iterate a Bound Listbox?

  • Thread starter Thread starter Daryll SHatz
  • Start date Start date
D

Daryll SHatz

What object is returned by a bound (to a DataSet) ListBox when it is
iterated?

Listbox.DataSource = DataSet1.MyTable
ListBox.DisplayMember = "Col1"
ListBox.ValueMember = "Col2"

Dim s as String
For Each itm In ListBox.Items
' what goes here to output the display text for each item in the
listbox?
s = itm.?????
Next

' I need s to be the values of Col1 displayed in the listbox.
 
The item should be a DataRow object.

If you're unsure, place a breakpoint in your For-Each loop, and look in the
Locals window to determine the type.

Hope this helps.
Mike
 
Back
Top