5
Answers

transfering item from one listbox to another

Ask a question
Milos

Milos

14y
6.4k
1
 private void ChangeTab(object sender, EventArgs e)

        {

            if (tabControl1.SelectedIndex == 1)                

            {

                listBox1.Items.Clear();

                listBox2.Items.Clear();

                foreach (Value mn in ValueList)

                {

                    listBox2.Items.Add(mn.getName());

                }

            }

            if (tabControl1.SelectedIndex == 0)

            {

                listBox1.Items.Clear();

                listBox2.Items.Clear();

                foreach (Value mn in ValueList)

                {

                    listBox1.Items.Add(mn.getName());

                }

            }

        }

       
What's the error in this code?I want to show value from listbox1 to listbox2?

Answers (5)