Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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.

Nothing is as illusive as 'the last bug'.
Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...