Hi, I'm developing an app that uses one timer and once the timer has ticked, there's no way to close my app without seeing that exception:
I've tryed to comment my timer functionality, so it does not tick, and it finishes well, and the same if I try to close my application before the timer has done its first tick. But once it has done this first tick I always get the exception below when I quit the app.
To finish the app I use te following code
myTimer is a System.windows.forms.timer
Does anyone know what I'm doing wrong??
VB.NET:
An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: Collection was modified; enumeration operation may not execute.
I've tryed to comment my timer functionality, so it does not tick, and it finishes well, and the same if I try to close my application before the timer has done its first tick. But once it has done this first tick I always get the exception below when I quit the app.
To finish the app I use te following code
VB.NET:
myTimer.Stop()
myTimer.Dispose()
Me.Close()
Me.Dispose()
Application.Exit()
myTimer is a System.windows.forms.timer
Does anyone know what I'm doing wrong??