foreach (int item in this.lbOA.Items) { int number = item; while (this.lbNA.Items.Contains(number)) { if (number < 18) { number++; } else { number = 8; number++; } } this.lbNA.Items.Add(number); } this.lbOA.Items.Clear();