G
Guest
Hi,
I hv foll. code:
foreach(object obj in myChkedlistbox.CheckedItems)
{
Messagebox.show(obj.tostring());
}
It gives me the foll exception:
"The list that this enumerator is bound to has been modified. An enumerator
can only be used if the list does not change."
I dont see where am I changing contents of myChkedlistbox list. What is
more surprising, at the same time the foll. (similar) code just works fine.
for (int i=0; i< dynColumns.CheckedItems.Count;i++)
{
object itemChecked = dynColumns.CheckedItems;
MessageBox.Show(itemChecked.ToString());
}
One more confusing thing is that the exception doesnt come on each run.
Once in a while the exception pops up and then after that its v.consistent
to the point that I reduce my code to:
foreach(object obj in myChkedlistbox.CheckedItems)
{} //Yes empty loop.
& still throws the exception..whoa !!
However If I do a clean-rebuild it goes away and just works :-? until some
mysterios next time when it decides to revisit again.
I hv foll. code:
foreach(object obj in myChkedlistbox.CheckedItems)
{
Messagebox.show(obj.tostring());
}
It gives me the foll exception:
"The list that this enumerator is bound to has been modified. An enumerator
can only be used if the list does not change."
I dont see where am I changing contents of myChkedlistbox list. What is
more surprising, at the same time the foll. (similar) code just works fine.
for (int i=0; i< dynColumns.CheckedItems.Count;i++)
{
object itemChecked = dynColumns.CheckedItems;
MessageBox.Show(itemChecked.ToString());
}
One more confusing thing is that the exception doesnt come on each run.
Once in a while the exception pops up and then after that its v.consistent
to the point that I reduce my code to:
foreach(object obj in myChkedlistbox.CheckedItems)
{} //Yes empty loop.
& still throws the exception..whoa !!
However If I do a clean-rebuild it goes away and just works :-? until some
mysterios next time when it decides to revisit again.