Getting this error when SETTING checkboxes in an Infragistics.Win.UltraWinListView.UltraListView
"collection was modified; enumeration operation might not execute".
I Googled "collection was modified; enumeration operation might not execute" and came up with
lots of advice to avoid this error when deletes are being done to the enum, advice not to use enum, etc.
BUT . . . I'm getting the error when I'M NOT removing anything from OR modifiying the enum in anyway,
except that boxes are being checked. Please advise.
code:
===================================================================================
.Items.SetCheckState(CheckState.Unchecked)
For Each row As CommonalitiesDataSet.CommonalityModelTypesRow In Me.CommonalitiesDataSet.CommonalityModelTypes
Next
End With
There are 5 UltraListView on this form/control.
If I rearrange the snippets for each of the 5 ULV's the error will occur on a different 1 of the 5, but the same error.
AND the error appears to be coming from the DataSet.DataTable enum . . . on the Next statement.
If I do something like
Me.CountryUltraListView.Items.SetCheckState(CheckState.Unchecked)
i += 1
str = CStr(row("CountryID"))
I can iterate thru the DataTable just fine . . . . and there are 5 rows in Me.CommonalitiesDataSet.CommonalityCountries
'Me.CountryUltraListView.Items(str).CheckState = CheckState.Checked
on only the 2nd time thru the loop ??????
===============================================
System.InvalidOperationException was caught Message="Collection was modified; enumeration operation might not execute." Source="System.Data" StackTrace: at System.Data.RBTree`1.RBTreeEnumerator.MoveNext()
Thx,
XPXJ