mhc
mhc

Reputation: 43

how to close mdiparent form from a dialogue form (like license form)

I'm trying to close my main form if the user clicks on the exit button on license form or close it.

I try this code on exit button but didn't work:

//--------------------------------------------------------------------

    private void button2_Click(object sender, EventArgs e)
    {
        Form1 aa=new Form1();
        aa.Close();
        this.Close();
    }

//--------------------------------------------------------------------

I'll be thankful if somebody can help me!

Upvotes: 0

Views: 1737

Answers (1)

yogi
yogi

Reputation: 19619

If that Parent form is the Main form in your application then you can use

Application.Exit();

To know more go here.

Upvotes: 1

Related Questions