I'm trying to build an application with a form window that needs to open and close another form by pressing a button. I want the same button to be used to open and close the same window.
private void button1_Click(object sender, EventArgs e)
{
//GameBoard gameBoard = new GameBoard(); is written outside the private void as global variable.
if (gameBoard == open)
{
gameBoard Close();
}
else
{
gameBoard.Show();
}
}
Thanks for any help.