Bilal Ahmed
Bilal Ahmed

Reputation: 1

jump to 2nd form and hide first form then close 2nd and show first form

I want to jump to 2nd form from first form in c# when I open 2nd and close main form by using below code all forms are close while jumping to 3rd by 2nd and do same then only 2nd form close and 3rd still on screen.

       {
        frmLogin login = new frmLogin();
            login.Show();
            this.Close();

    }

how I able to close main form without closing all other forms??? (Note: I am new so any mistake i made please ignore it.)

Upvotes: 0

Views: 166

Answers (1)

PieterSchool
PieterSchool

Reputation: 509

Try this:

private void OpenMainForm()
{
    var login = new frmLogin();
    this.Hide();          
    login.ShowDialog();
    this.Show();          
}

Upvotes: 1

Related Questions