ralphtrent
Programmer
Hi,
I have googled and tek-tip searched to no avail.
.Net version is 2.0
I have a ListBox that is bound to a datatable. I need to allow the user to remove some of the items in this ListBox. When I do the following code:
I get the following Exception :
Something else I have tried was to place all the selected items into a datarow array and then remove each row that was in the array in the datatable. When I do that I get a DataRowNotInTableException.
I have not idea why it seems to difficult to remove these tiems successfully.
Any help is GREATLY appreciated.
Thanks,
RalphTrent
I have googled and tek-tip searched to no avail.
.Net version is 2.0
I have a ListBox that is bound to a datatable. I need to allow the user to remove some of the items in this ListBox. When I do the following code:
Code:
ListBox.SelectedObjectCollection lsicSelectedUsers = lbUser_UsersSelected.SelectedItems;
foreach (DataRowView drw in lsicSelectedUsers)
{
gdtSelectedUsers.Rows.Remove(drw.Row);
}
Code:
InvalidOperationException:
List that this enumerator is bound to has been modifed. An enumerator can only be used if the list has not been modified.
Something else I have tried was to place all the selected items into a datarow array and then remove each row that was in the array in the datatable. When I do that I get a DataRowNotInTableException.
I have not idea why it seems to difficult to remove these tiems successfully.
Any help is GREATLY appreciated.
Thanks,
RalphTrent