4
Reply

Wondering using listbox c#

Lucky Lam

Lucky Lam

Oct 9 2013 9:27 PM
839
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)
Next Recommended Forum