public void Exit() //Method to return to Main Menu { MessageBox.Show("Thank you for playing Snakes & Ladders! You will now be returned to the Main Menu."); this.Close(); //Closes game form Form_Menu MainMenu = new Form_Menu(); MainMenu.Show(); //Reopens Menu }
public void btnPlay_Click(object sender, EventArgs e) { //States default player names if custom textboxes are left blank/empty if (String.IsNullOrEmpty(txtPlayer1Name.Text) || String.IsNullOrWhiteSpace(txtPlayer1Name.Text)) { this.txtPlayer1Name.Text = "Player 1"; } if (String.IsNullOrEmpty(txtPlayer2Name.Text) || String.IsNullOrWhiteSpace(txtPlayer2Name.Text)) { this.txtPlayer2Name.Text = "Player 2"; } StartGame.txtPlayer1Name.Text = this.txtPlayer1Name.Text; //Transfers Names to game StartGame.txtPlayer2Name.Text = this.txtPlayer2Name.Text; Form_Menu Menu = new Form_Menu(); //Hides main menu and opens game to begin round this.Hide(); Menu.Close(); StartGame.Show(); }