Lucky Lam

Lucky Lam

  • NA
  • 13
  • 4.2k

Wondering using listbox c#

Oct 9 2013 9:27 PM
I have looking for error on these code all day, but I really don't understand why it didn't work
private void button2_Click(object sender, EventArgs e)
{

        int numberItems = listBoxMenu.Items.Count;
         for(int i=0;i<numberItems;i++)
        {
                if (listBoxMenu.GetSelected(i))
                {

                        listBoxChosen.Items.Add(listBoxMenu.Items[i]);
                        listBoxMenu.Items.RemoveAt(i);
                }
        }


}
These code above try to insert selected item from lisboxMenu to listBoxChosen...
I appreciate for your help

Answers (4)