Closing a Window Form

This blog defines how to close a Window Form.
 
//closing button

    private void close_btn_Click(object sender, EventArgs e)

    {

        DialogResult dialog = MessageBox.Show("do u want to close", "Exit", MessageBoxButtons.YesNo);

        if (dialog == DialogResult.Yes)

        {

            Application.Exit();

        }

        else if (dialog == DialogResult.No)

        {

            // e.Cancel = true;

        }

    }

 

Ebook Download
View all
Learn
View all