c# can't close application
<p>I'm developing a c# application and when the user clicks on the X the application gets minimized inside a trayicon. Like so:</p>

<pre><code>private void frmChat_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            Hide();
        }
</code></pre>

<p>The application is really simple (only one form) the problem is that I can't managet to close properly the application. When the user rights clicks on the tray icon and he chooses "exit" he should be able to close the application, the problem is that even if the tray icon gets unloaded and the form closed the application still shows in the task manager as an active application. I'm closing the app like this:</p>

<pre><code>private void chiudiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            trayIcon.Dispose();
            this.Close();
            Application.Exit();
        }
</code></pre>

<p>What am I missing here?</p>

<p>Thanks</p>
