Programming Newbie Programming Newbie - 1 year ago 138
C# Question

Using Exit button to close a winform program

I have an exit button on a winform that I want to use to close the program. I have added the button name to the FormClosed property found in the events section of the winforms properties. I thought that's all I had to do but when I click the button it does not close. I looked at the code and while a handler is created, there is no code inside of it. I don't know if that is correct or not. Here is the code that was created in the Form.cs file:

private void btnExitProgram_Click(object sender, EventArgs e)


What else do I have to do?

Answer Source

Closes the form programmatically.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download