User-1671087770 posted
I've created a ShoppingCart class that is a list of another class - cartItems. I want to be able to remove a cart item and I'm struggling a little with how to go about it correctly.
I've tried the following:
For Each item As CartItem In Profile.ShoppingCart.Items
If item.ItemID = 11 Then
Profile.ShoppingCart.Items.Remove(item)
End If
Next
But get this error: Collection was modified; enumeration operation may not execute.
Is there a way round this. I want the user to be able to delete an item from their shopping cart. (the shopping cart is stored as profile info)
Thanks in advance