Hi,
Can we have a ListBox ValueMember Collection?
If we have SelectionMode as MultiExtended, and we select
more than one
values in the listbox, then can we show its respective value
member as
we can show the SelectedIndices (Collection of selected
index)
I am displaying some value in the listbox and actually
require some
different value, say for e.g. i am showing names in the box
whereas if
the user selects a name i am retriving the corresponding
employee ID
for that name. Now this scenario is possible through
ValueMember and
DisplayMember property of ListBox.
DisplayMember = name
ValueMember = empId
Now the following code works fine if i need to retrive the
DisplayMembers from listbox..
for(int i=0;i < listBox1.Items.Count;i++)
{
if(listBox1.GetSelected(i))
{
MessageBox.Show("",listBox1.GetItemText(listBox1
.Items[i]));
}
}
My question though,here is i needed the ValueMembers to
corresponding
selections
I find this as a bug that MS needs to correct OR
If there is a way could any one please post an example with
it..
And if there is not then What are the alternatives (without
using and
temp array to keep track of it..some memory mgmt is required
here)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharp googlegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribe googlegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---
|