   Exitting an Application
  Right now I'm calling Application.Exit() in a child dialog, but when the child dialog exits, the parent form still runs for a little bit, which is not good.How do I make sure it exits faster?Edit:Well I solved the problem seconds after posting this, I'm still curious about ways to do it though.Edit Again: I thought I solved it, but I did not. :(   
  There is additional processing that must take place before your application can exit.  When you call Application.Exit() it posts a message to quit, but it can take a while before everything finishes up.It is common to hide all visible windows when shutdown processing takes some time.You should review your program to see what is taking so long to clean up.  That's not a task that can easily be handled in the forums, and it requires a good knowledge of what the system is doing for you.Hope that helps.   ;  I've just now realized that the program is not exiting at all. =/if (Login() == false){    Hide();    Application.Exit();    return;}In fact, it's not calling Hide() either. It's like it's skipping to the return.   ;Quote:Original post by NecoSpesI've just now realized that the program is not exiting at all. =/*** Source Snippet Removed ***In fact, it's not calling Hide() either. It's like it's skipping to the return.have u tried setting a break point and stepping through that if statement? im pretty sure it never enters it and goes to a return statement further down in your code...we could help you more if u posted more of the code...   ;  Yes, I've already done that, and it does enter the if statement.There's quite a bit of code, but here is some more:public bool Login()   {  if (LgnDlg.ShowDialog() == DialogResult.Cancel)  { return false;  }  return true;   }That's the Login() function. LgnDlg is a form that has an button that returns DialogResult.Cancel, and is supposed to trigger the Application.Exit(). Before, I had the button in LgnDlg directly call Application.Exit(), but that didn't work. =/   ;  just call std c exit() to terminate entire applicationhttp://msdn.microsoft.com/en-us/library/k9dcesdd(VS.80).aspx   ;Quote:Original post by NecoSpesI've just now realized that the program is not exiting at all. =/*** Source Snippet Removed ***In fact, it's not calling Hide() either. It's like it's skipping to the return.As frob might have poited out earlier, there's something must be taken note :The Exit method stops all running message loops on all threads and closes all windows of the application. This method does not necessarily force the application to exit. The Exit method is typically called from within a message loop, and forces Run to return. To exit a message loop for the current thread only, call ExitThread. and  The Exit method does not raise the Closed and Closing events, which are obsolete as of .NET Framework 2.0.I had a multhithreaded apps that call this Application.Exit() Method and was not dispose properly.   ;  Couldn't you just use Destroy();   