473,326 Members | 2,192 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,326 software developers and data experts.

Retrieving Multiple selected items from a data bound listbox

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 of the datatable. I set the
SelectionMode property to MultiExtended.

I am able to load and select multiple lines in the listbox but I can not
figure out how to retrieve both columns for each line selected in the
listbox. I know that there is a SelectedItems collection that contains the
lines selected in the list box but I cannot retrieve both columns for each
item in the SelectedItems collection.

Does anyone know how to accomplish this?

Thanks
Nov 20 '05 #1
3 3818
Hi Davix,

What do you mean two columns, the display and the value member?

Than there is as well a property SelectedValue however tell us first if you
mean this?

Cor
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 of the datatable. I set the
SelectionMode property to MultiExtended.

Nov 20 '05 #2
Cor,

I have already tried the DisplayMember and the SelectedValue properties.
They only contain the information for the first selected item in the list.
I could not retrieve the values for any other selected items in the list.

Thanks,
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:eC**************@TK2MSFTNGP10.phx.gbl...
Hi Davix,

What do you mean two columns, the display and the value member?

Than there is as well a property SelectedValue however tell us first if you mean this?

Cor
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 of the datatable. I set the
SelectionMode property to MultiExtended.


Nov 20 '05 #3
Hi David,

A real challenge to find I think it is this

I hope it helps?

Cor
\\\
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim ar(ListBox1.SelectedItems.Count) As String
For i As Integer = 0 To ListBox1.SelectedItems.Count - 1
ar(i) = DirectCast(ListBox1.SelectedItems(i),
DataRowView)(1).ToString
Next
End Sub
///
Nov 20 '05 #4

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

Similar topics

1
by: theoryboy | last post by:
I'm trying to implement multiple selection functionality in a Tix Hlist using a control-click. I've bound control-click to a function that uses selection_set to add to the selection, but it doesn't...
0
by: bill yeager | last post by:
Duray, it helps in regards to knowing how to get the items that were selected in the lisbox, but I'm going in reverse --- after I get the items from the db that were selected, I'd like to be able...
1
by: sab | last post by:
Hi, We have a web form with a listbox. The listbox is a multiple select listbox and has data that looks something like: ALL Unit 1 Unit 2 Unit 3 Note: "ALL" is always the first item in...
4
by: Bill Nguyen | last post by:
I would like to be able to do the following: Listbox1/Textbox1 contains list of all items not selected item A item B item D Listbox2//Textbox2 contains list of all items selected
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...
10
by: ads | last post by:
hi, after binding the dropdownlist to a datasource, ive experience this error "Cannot have multiple items selected in a dropdownlist" after using the code:...
3
by: Jay Ruyle | last post by:
I'm trying to figure out a way to list several items in a listbox and let the user select any number of items in the listbox. I have tried to code in the items as bitwise items but all it stores...
6
by: Pippen | last post by:
Hi, I'm trying to read all the selected items in a ListBox. So after the user selects the values they want in the ListBox they select a button. This is where I want to put into a string all the...
2
by: phpnewbie26 | last post by:
I currently have two drop down menus where the second one is populated from the first one. My second drop down menu should be able to do multiple selection. I have searched online and found out how...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.