Every time you create a new Form inside a Method, the "life-time" of that Form is limited to the
scope of the Method. So, the new Forms you create inside the two Methods you show here essentially "don't exist" outside those Methods.
Assuming you have a "Main Form" (that you are using the default Windows Form App that Visual Studio creates):
1. create re-usable instances of your other two Forms in the Main Form's Class scope:
Form2 form2Instance = new Form2();
Form3 form3Instance = new Form3();
and make visible (using 'Show) as necessary.
What if you want to have a Button on these "secondary" Forms that takes you back to the Main Form ? Expose a Public Action delegate in the secondary Forms:
public Action<form> GetBackHome { set; get; }</form>
Then, when the user clicks a Button in Forms 2, or 3 named 'GoBackToMain:
private void GoBackToMain_Click(object sender, EventArgs e)
{
if(GetBackHom != null) GetBackHome(this);
}
Then, in the Main Form, you can insert a "return from" delegate instance into Forms 2, and 3:
form2Instance.GetBackHome += returnedFromSecondaryForms;
private void ReturnedFromSecondaryForms(Form theForm)
{
Console.WriteLine("returned from Form: {0}", theForm.Name);
this.Focus();
theForm.Hide();
}
Note:
1. think carefully about when you want to 'Hide a Form, rather than 'Close it. Use Hide(); when you want to keep the Form "alive," re-use it. Use "Close(); when you want to delete the reference to the Form (the reference will then be garbage-collected automatically unless you've done something weird).