To exit the application
I need to exit the application when the user clicks the close button.but what is happening in my project is that only when the user clicks the close button of login form(which is the startup form) application exists.But when user closes other forms project is in running mode.it does not breaks....how to solve this problem..PlZ help me.......

Roei BarRank #1,271 · 1.4K reputationPosted Sep 10, 2009, 3:15 AM EDT
protected void button1_Click(object sender, System.EventArgs e) { // Populates a list box with three numbers. int i = 3; for(int j=1; j<=i; j++) { listBox1.Items.Add(j); } /* Determines whether the user wants to exit the application. * If not, adds another number to the list box. */ while (MessageBox.Show("Exit application?", "", MessageBoxButtons.YesNo) == DialogResult.No) { // Increments the counter ands add the number to the list box. i++; listBox1.Items.Add(i); } // The user wants to exit the application. Close everything down. Application.Exit(); }Resmy Ravi74 reputationPosted Sep 10, 2009, 3:25 AM EDT
Danatas GerviRank #4,152 · 361 reputationPosted Sep 10, 2009, 3:29 AM EDT
For every FormClosed event handler. I mean - every form should implement this behavior...
Kirtan PatelRank #292 · 8.6K reputationPosted Sep 10, 2009, 4:05 AM EDT
Write Below Code for Every Form
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
Roei BarRank #1,271 · 1.4K reputationPosted Sep 10, 2009, 10:05 AM EDT
on any event that you request to exit the application on your form