I have 2 Forms, Startform is a Login Form (Form1) and a Form that opens after Login, Form2.
when Login is successful the form2 shows.
f2.Show(); //form2 show
this.Hide(); //login(f1) hide
This works.
Now i want that if i press the red X Button (right top) that Form2 close and the Login page shows again.
I tried this in Form2:
Form1 f1 = new Form1();
....
...
private void Main_FormClosing(object sender, FormClosingEventArgs e)
{
f1.show();
}
But this just close the Form2 and not open the From1 and the Program is still running in the Background