I have a couple of forms.
Let's call them mainForm
, formA
and formB
.
On mainForm
, there's a button that goes to formA
and the button that does that has this bit of code:
private void buttonOpenFormA_Click(object sender, EventArgs e)
{
formA displayformA = new formA();
displayformA.Show();
this.Hide();
}
And on formA
, I have another button that opens formB
like this:
private void buttonOpenFormB_Click(object sender, EventArgs e)
{
formB displayformB = new formB();
displayformB.Show();
this.Hide();
}
And to return to mainForm
:
private void buttonGoBack_Click(object sender, EventArgs e)
{
mainForm displayMainForm = new mainForm();
displayMainForm.Show();
this.Close();
}
And on formA, this works beautifully. But on formB, however, this same block of code refuses to show the mainForm
. What am I doing wrong?