I have two listboxes side by side. The listbox on the left is bound to a table, and shows Sql selected data from that table. I need to Add selected items from this listbox to the listbox on the right which is not bound to anything. The Listbox on the left has the following properties:
DisplayMember= Text field giving a display name from the table
ValueMember=UniqueID for item in the table
When I use the following:
RightSideListBox.Items.Add(LeftSideListBox.SelectedValue)
all I get is the Valuemember appearing in the right hand listbox. What I need is the DisplayMember showing in the right hand listbox, and some way of also recording the Valuemember, so I can retrieve data from the same table later, based on the UniqueID it returns for the originating table.
I tried using :
RightSideListBox.Items.Add(LeftSideListBox.SelectedItem)
but while that appears to add the datarow object to the right hand listbox, it displays 'System.Data.DataRowView' in the listbox control. Again, what I need is to see the same DisplayMember for the selected item in the left side listbox displayed in the right side listbox, and have some way of retrieving the ValueMember for later use.
Any help is greatfully appreciated!
Regards,
James
DisplayMember= Text field giving a display name from the table
ValueMember=UniqueID for item in the table
When I use the following:
RightSideListBox.Items.Add(LeftSideListBox.SelectedValue)
all I get is the Valuemember appearing in the right hand listbox. What I need is the DisplayMember showing in the right hand listbox, and some way of also recording the Valuemember, so I can retrieve data from the same table later, based on the UniqueID it returns for the originating table.
I tried using :
RightSideListBox.Items.Add(LeftSideListBox.SelectedItem)
but while that appears to add the datarow object to the right hand listbox, it displays 'System.Data.DataRowView' in the listbox control. Again, what I need is to see the same DisplayMember for the selected item in the left side listbox displayed in the right side listbox, and have some way of retrieving the ValueMember for later use.
Any help is greatfully appreciated!
Regards,
James