This is the cleanest way I found of doing it. You can't do it with foreach loops as by removing an item, you are changing what you are iterating through. Its more of a safety mechanism than an error. This works both ways.
Code:
private void SwapItems(ListBox source, ListBox dest)
{
while (source.SelectedItems.Count != 0)
{
dest.Items.Add(source.SelectedItem);
source.Items.Remove(source.SelectedItem);
}
}
Regards,
Dominic