I am working on C# using ASP.net 2.0
I have Listbox, There I have a button to add the values It works fine.
Also there is button to remove the selected values.
When I use my below code, It gives me error saying
An exception of type 'System.InvalidOperationException' occurred in mscorlib.dll but was not handled in user code
Additional information: Collection was modified; enumeration operation may not execute.
toplevel: Exception of type 'System.Web.HttpUnhandledException' was thrown.
inner: Collection was modified; enumeration operation may not execute.
Code on Remove button click is:
foreach (ListItem lstItm in List_Options.Items)
<asp:ListBox ID="List_Options" runat="server" Rows="6" SelectionMode="Multiple"></asp:ListBox>