I'd like to move items from one list view to another. adding them to the second one works but the moved entries don't get removed at all.
private void MoveSelItems(ListBox from, ListBox to)
{
for (int i = 0; i < from.SelectedItems.Count; i++)
{
to.Items.Add(from.SelectedItems[i].ToString());
}
from.Items.Remove(to.SelectedItem);
}
I'm using C# / Winforms / -NET 3.5
Try this code instead at the end of the loop
foreach ( var item in new ArrayList(from.SelectedItems) ) {
from.Items.Remove(item);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With