List box bounded with dataset
Hi all
I am using visual studio 2005 (c#) for developing my windows application. I am having two list boxes, I want to transfer selected items from one list box to another list box. When the list box contain normal data (i.e. List items not from the database). The below CODE:1 works fine.
CODE:1
foreach (object item in listBox1.Selecteditems)
{
string ite = item.ToString();
listBox2.Items.Add(ite);
}
CODE:2
listBox1.DataSource = datasetName.Tables["table_name"];
listBox1.DisplayMember = "Column_name";
listBox1.ValueMember = "Column_name";
The problem is when I am populating the listitems from the database using CODE:2 .The CODE:1 instead of transferring selected items to the destination list box, It transferring "System.Data.DataRowView" to the destination list box. Help me to solve this.
ganesh.k
|