473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to Iterate a Bound Listbox?

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.

Nov 20 '05 #1
2 5090
ListBoxName.Items.Add(itm.text)
"Daryll SHatz" <ds****@cox.net> wrote in message
news:#q**************@TK2MSFTNGP10.phx.gbl...
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.

Nov 20 '05 #2
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

"Daryll SHatz" <ds****@cox.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
1
by: Jakob Nielsen | last post by:
I have implemented a container class with IList and bound it to a listbox. Works just fine, but if i then add a new item to my list, the listbox is not updated. Looking at the definition for...
2
by: COHENMARVIN | last post by:
I've been doing a simple for-each loop to remove multiple selected items from one listbox, and to dump them in another listbox. for each item in LeftListBox.Items if (item.Selected = true) Then...
3
by: David L Wright II | last post by:
I have a data bound listbox that I want to select multiple lines then process each line. I bound a two column datatable to the listbox and set the DisplayMember property to the appropriate column...
0
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing...
1
by: Spock | last post by:
Hi. I have a form with a listbox and a few label fields all bound to a dataset. When i navigate the listbox the labels change accordingly. so far everything works good. I made a button to...
3
by: Richard Albrecht | last post by:
I have been trying to figure out for days on how to read values from a Bound ListBox. The listBox gets the values from an Access Table. I can read values fine for Non-Bound ListBoxes, But the...
0
by: Tony Botelho | last post by:
I am fairly new to VB.NET and I am having some difficulty working with a bound listbox. On a simple form, I open a connection to my database and load a dataser. I then bind a listbox to the the...
17
by: SenileOwl | last post by:
I'm very new to the whole programming thing and I'm having a little trouble with the syntax of my code. My code contains a bound listbox where the display member and value member are two different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.