Using the code you have been given so far you will be creating a new instance of Form1 each time the button in Form2 is clicked, which is probably not what you are wanting.
To show your original Form1 you should create an event in Form2 that your hidden Form1 instance subscribes to, so it can show itself:
public event EventHandler ButtonClicked;
protected virtual void OnButtonClicked(EventArgs e)
{
EventHandler eh = ButtonClicked;
if (eh != null)
eh(this, e);
}
private void button1_Click(object sender, EventArgs e)
{
OnButtonClicked(e);
}
private void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.ButtonClicked += new EventHandler(form2_ButtonClicked);
form2.Show();
Hide();
}
private void form2_ButtonClicked(object sender, EventArgs e)
{
Form form2 = sender as Form;
if (form2 != null)
{
form2.Close();
Show();
}
}
Another way is Constructor Injection into Form2 so it receives the Form1 instance, but this is rarely a good idea as it couples Form2 to Form1.