Tuesday, August 28, 2018

Make a button in a WinForms application that just closes the app.

private void button1_Click(object sender, EventArgs e)
{
   Application.Exit();
}

 
 

...assuming that in the .Designer.cs file you have a wire up like so:

this.button1.Click += new System.EventHandler(this.button1_Click);

No comments:

Post a Comment