fguihen Posted April 19, 2005 Posted April 19, 2005 im getting this error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll Additional information: Collection was modified; enumeration operation may not execute. i have no controls on the forum. i have overriden the onPaint method and the OnPaintBackground method. in my own paint method im drawing a simulation to the screen. i have bots, to which i pass a graphics object and draw them. each time they move, i invalidate the form and redraw. when they start moving too much, i get the error above. any ideas? Quote
Administrators PlausiblyDamp Posted April 19, 2005 Administrators Posted April 19, 2005 Any chance you could post the code in question? Also are you looping over any arrays / collections in your code? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Wile Posted April 19, 2005 Posted April 19, 2005 Without code (hint hint ;) ) I would guess that you are putting some information that you use in a foreach loop, while at the same time, an item is added/removed from this collection. But we can't do much more than guess without some code, at least the lines where the exception occurs. Quote Nothing is as illusive as 'the last bug'.
fguihen Posted April 19, 2005 Author Posted April 19, 2005 im sorry for not checking back sooner. i found out what was wrong. i was calling a paint method from within a paint method ( i dont know why) but this was causing the exception. sorry for bothering you Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.