I am coding Winforms in C#. I want to set up my program so that if a form is closed, the program will terminate or stop. I already know how to select a form that will be opened first.
This is the code in my program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace MainMenu
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Login());
}
}
}
I want to set up my login.cs form so that if that form is closed, the program will terminate. Is this possible?
`