Disable closing of a certain WinForm
<p>I'd like to know if there's a possible solution (I hope there is) to my problem. I have two forms, the Login Form and the Main Form. I'd like to know if there's a way to disable closing of the Main Form and only allow closing when I sign out (which redirects the user back to the Login Form) and only allow closing when Login Form is active. Sorry for my bad english. </p>

<p>I tried using the event below, yes it stops me from closing the main form but when I signed-out it did the same to my Login Form which I didn't want to happen. Is there any way to do this?</p>

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