0

I have created a Winforms application in C#, where I have provided Exit button. And on the click of that button I execute custom function, where I have written

Application.Exit();

But it's showing error:

enter image description here

devavx
  • 1,035
  • 9
  • 22
  • this might help http://stackoverflow.com/questions/7912052/system-invalidoperationexception-due-to-collection-modification-on-call-to-appli – Nithin Nayagam Sep 15 '13 at 17:33
  • Copy the exception detail to the clipboard, use the stack trace to determine where it was thrown, then post the relevant code from that section. – musical_coder Sep 15 '13 at 17:35
  • It is showing error on the same line Application.Exit(); – jeevesh kumar Sep 15 '13 at 17:55
  • The exception is telling you that you are modifying a collection within a loop--like a foreach loop. Look for any uses of a collection when you process the Close event... – Peter Ritchie Sep 15 '13 at 18:16

0 Answers0