views:

22

answers:

3

I am using visual studio 2008 with vb as my language. I have a databound multiextended listbox. I need to get the selected value for each item that is selected. I have searched for two weeks trying to find and answer. Can anyone help? I would greatly appreciate it.

A: 

How about this:

For Each Item In ListBox1.SelectedItems
            //Do Stuff here to the item
        Next
daft
rip
A: 

when i try this:

For Each item In ListBox1.SelectedItems
            Label10.Text = Label10.Text + item.ToString & vbCrLf
        Next

i get the following result int he label10 text:

chirp_Sql.status
chirp_Sql.status
chirp_Sql.status

chirp_Sql is the name of my database and status is the name of the field. How can I get the actual value instead of that? Thanks for the help.

rip
What are the actual values that you are displaying in the listbox? When I use the above code I can easily present the actual items in a label and select multiple values in the listbox using Ctrl + Left click without any problems.
daft
A: 

Something is up with the way you are binding your data to the listbox in the first place, or you need to do a "DirectCast" of the item before you can see it's contents.

Carter