xxxxxxxxxx
// In a console application:
Environment.Exit(0);
// In a WPF application:
Close();
xxxxxxxxxx
if (System.Windows.Forms.Application.MessageLoop)
{
// WinForms app
System.Windows.Forms.Application.Exit();
}
else
{
// Console app
System.Environment.Exit(1);
}
xxxxxxxxxx
private void button1_Click(object sender, EventArgs e) // this is your button double click your button and you will find it
{
Application.Exit();
}