3
Reply

Add selected item from a bound listbox to a unbound listbox

Ameya Bedarkar

Ameya Bedarkar

Feb 5 2015 2:32 AM
811

     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)