Wouter

Wouter

  • NA
  • 3
  • 0

compare and move values in a listbox

Jul 4 2010 7:21 AM
Hello,

Iam trying to add all the values from the left listbox (OA) into the right listbox(NA) but the values may not be duplicated. If the values are the same it must be increased with 1 until it is not duplicated.
This is probably very simple but it doesn't seem to work (and im kinda new to C# to be honest haha).

thanks in advance !


Wouter


UPDATE:
code:
             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();


Answers (3)