How to hide form when 2nd Form opens?

shah123's Avatar
Contributor
I have a form where there is a button and i want to launch an another form by the help of that button which is done but when second form opens it doesnt close the first one as i did many tries.

Following is my code snippet
Code:
private void LoadGameButton_Click(object sender, EventArgs e)
        {
            TicTacToe tic=new TicTacToe();
            tic.Show();
            log = new Login();
            log.Close(); // or i tried hide and different ways here but still login form appear 

        }
Please help
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You need to close before the show.
0
shah123's Avatar
Contributor
TicTacToe tic=new TicTacToe();
tic.Show();
this.Hide();

This was the solution. Thanks Shabbir