Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your first form is set as the startup form. That means whenever it gets closed, your entire application is closed. And conversely, your application does not close <em>until</em> it gets closed. So when you hide the startup form and show the second form, the user closing the second form does not trigger your application closing because they have only closed a secondary, non-modal dialog.</p> <p>I recommend changing your design so that the startup form is also the <em>main</em> form of your application. No sense trying to work around built-in functionality that can actually be useful. You want the application to quit when the main form is closed, no matter what other child forms are opened.</p> <p>But the quick-and-dirty solution in your case is to make a call to <strong><a href="http://msdn.microsoft.com/en-us/library/ms157894.aspx" rel="nofollow noreferrer"><code>Application.Exit</code></a></strong>. That will close <em>all</em> of the currently open forms and quit your application immediately. As I said just above, I don't so much recommend this approach because having to call <code>Application.Exit</code> from every form's <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosed.aspx" rel="nofollow noreferrer"><code>FormClosed</code></a> event handler is a sign that something has gone seriously wrong in your design.</p> <p>If the single startup form paradigm doesn't work out for you, you should look into taking matters into your own hands and customizing the <code>Main</code> method in your <code>Program.cs</code> source file. See the answers given to <a href="https://stackoverflow.com/questions/4759334/how-can-i-close-a-login-form-and-show-the-main-form-without-my-application-closin">this related question</a> for some ideas on how that might work for you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload