/// <summary> /// delete all the items from the right listbox and add to the left listbox if there are no duplicates /// </summary> private void allToLeft_Click(object sender, EventArgs e) { int[] LeftArr = ClassSom1.GetArrFromList(ListLeft); int[] RightArr = ClassSom1.GetArrFromList(ListRight); int Length = ClassSom1.LengthOfArrayWithoutDuplicates(RightArr, LeftArr); LeftArr = ClassSom1.MoveAllItems(RightArr, LeftArr, Length); ClassSom1.FillListFromArray(LeftArr, ListLeft); ListRight.Items.Clear(); }
/// <summary> /// delete the selected item in the left listbox and add in the right listbox /// </summary> private void selecToRight_Click(object sender, EventArgs e) { if (ListLeft.SelectedIndex != -1) { int[] LeftArr = ClassSom1.GetArrFromList(ListLeft); int[] RightArr = ClassSom1.GetArrFromList(ListRight); RightArr = ClassSom1.AddSingleItem(ListLeft.SelectedIndex, ListRight.Items.Count, LeftArr, RightArr); LeftArr = ClassSom1.DeleteItem(ListLeft.SelectedIndex, ListLeft.Items.Count, LeftArr); ClassSom1.FillListFromArray(LeftArr, ListLeft); ClassSom1.FillListFromArray(RightArr, ListRight); } }