I'm not sure I fully understand your question, but it seems like you are trying to remove an entry from the collection while you are still fixated on it. (which will result in an array index error)
You must save the link to each entry that you want to delete in the new collection, and then delete all new entries from the old collection:
DataRow[] dr = payments.dtPayments.Select(myselect); List<DataRow> rowsToRemove = new List<DataRow>(); for (int a = 0; a < dr.Length; a++) { if() { rowsToRemove.Add(dr[a]); } } foreach(var dr in rowsToRemove) { payments.dtPayments.Rows.Remove(dr); }
Yona
source share