Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Common Exit Button Code 2

Status
Not open for further replies.

RoguePoet01

Programmer
Oct 1, 2003
302
0
0
US
Hi,

Does anybody have a snippit of common exit button code that I could look at?

Something that closes the form and ends the program.

It's something so basic, but I can't find any examples anywhere.

Thanks.
 
Found it!

private void btnExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
 
private void btnExit_Click(object sender, System.EventArgs e)
{
Form1.Dispose(true);
}
 
Thanks WebStar. I'll try that, too. That one probably only closes the form without ending the program.

I'm painfully new to this....
 
Just to let you know, that code gave me an error.

I had to use

private void btnExit_Click(object sender, System.EventArgs e)
{
this.Dispose(true);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top