3
Answers

Add selected item from a bound listbox to a unbound listbox

Ask a question

     i want to add selected item from a data bounded listbox (listbox1) to another listbox (listbox2)

         Here is the code on a click event of a button.

     private void btnrgt_Click(object sender, EventArgs e)
    {
        string x = listBox1.SelectedItem.ToString();
        listBox2.Items.Add(x.ToString());
        txttestno.Text = listBox2.Items.Count.ToString();
     }

When i run this code System.data.datarowview get displayed in the listbox2.

Kindly help. thank you in advance.


Answers (3)