'How do I close the whole application when I close a form?
I have two forms in my application, Login and Dashboard. After the login the dashboard form is loaded and login "closes" with this.Hide. If I close the dashboard with the X button the application continues to run but nothing shows.
Solution 1:[1]
Use Form2 [Dashboard] events.
private void Form2_FormClosed(object sender, FormClosedEventArgs e)
{
// when form closed
Application.Exit();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
// before form close
Application.Exit();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | thisisnabi |
