I am trying to figure out what I should use. When my WinForm application closes, Form in Dialog mode is triggered. In this form, a background worker works, which synchronizes the database with the remote database and displays its progress in a โburst formโ.
I have a way like this:
private void CloseMyApp() { SaveUserSettings(); splashForm = new SplashForm(); splashForm.ShowDialog(); Application.ExitThread();
which I call to close my application from Menu โ Exit and in the Form_FormClosing() event. Application.Exit() gives the following error ->
The collection has been modified; enumeration operation cannot be performed.
Now I read that Environment.Exit() is cruel and means that maybe something is wrong with your application (see here ).
Application.ExitThread() works, but I am convinced that it can only be APPEARING working, and since I have never used it before, I am not sure when this is usually suitable for this.
Refracted Paladin Aug 21 '09 at 16:10 2009-08-21 16:10
source share