//Runs when the play button is clicked private void cmdPlay_Click(object sender, EventArgs e) { //Create a new instance of the form 'frmGamePlay' frmGamePlay frmGamePlay = new frmGamePlay(); //Hide the main menu this.Hide(); //Show the newly created form frmGamePlay.ShowDialog(this); //Close the current form //this.Close(); }
//Start a new game private void playAgain() { //If no score has been added to the highscore board if (!scoreAdded) { //Add score with the name 'Unknown' addScoreToHighScores("Unknown", iScore); } //Create a new instance of the form 'frmGamePlay' frmGamePlay frmGamePlay = new frmGamePlay(); //Hide the current form this.Hide(); //Show the newly created form frmGamePlay.ShowDialog(this); //Close the current form this.Close(); }