title: How do I properly exit a C# application?
body: <p>I have a published application in C#. Whenever I close the main form by clicking on the red exit button, the form closes but not the whole application. I found this out when I tried shutting down the computer and was subsequently bombarded by lots of child windows with <code>MessageBox</code> alerts I added.</p>
  <p>I tried <code>Application.Exit</code> but it still calls all the child windows and alerts. I don't know how to use <code>Environment.Exit</code> and which integer to put into it either.</p>
  <p>Also, whenever my forms call the <code>FormClosed</code> or <code>FormClosing</code> event, I close the application with a <code>this.Hide()</code> function; does that affect how my application is behaving?</p>