I have a form1 that opens a form2 that opens a form3. I want to return to form1 from form3 using a button.

form1

```
private void form2button_Click(object sender, EventArgs e)
{
    this.Hide();
    form2 f2 = new form2();
    f2.ShowDialog();
    this.Show();
}

```

form2

```
private void form3button_Click(object sender, EventArgs e)
{
    this.Close();
    form3 f3 = new form3();
    f3.ShowDialog();
}
private void exitbutton_Click(object sender, EventArgs e)
{
    this.Close();
}

```

form3

```
private void mainmenubutton_Click(object sender, EventArgs e)
{
    this.Close();
}
private void backbutton_Click(object sender, EventArgs e)
{
    this.Close();
    form2 f2 = new form2();
    f2.ShowDialog();
}

```

But when in form3, after clicking the back button it shows form2 but form3 is still in the background. I have fixed this by adding `this.Hide();` before `this.Close();` 

I would like to know the logic behind why this happening.