I am kinda stuck with this. Let me explain...
This is a Windows Application. I have a listbox that is bound to a dataset table.
DA.Fill(DS) 'DA is Adapter, DS is DataSet
ListBox1.DisplayMember = "EmpName"
ListBox1.ValueMember = "EmpID"
ListBox1.DataSource = DS.Tables(0)
Everything works fine. Now all I need is to get the ValueMembers for selected items in the list box. Lets make a string with all the values...
Dim itm As Object
Dim ValueString As String = "Selected Values are : "
For Each itm In ListBox1.SelectedItems
ValueString &= ListBox1.SelectedValue.ToString() & ", "
What I am getting now:
If I select only a single Item, I get the right value.
But, when I select multiple items, it gives me the first value all the time. What I meant is, say I selected 3 items, and my first VALUE is 40. Then my ValueString is : "Selected Values are : 40, 40, 40, "... this is what I am getting.
Need to get it right ... anybody ??