//On click of the button ok event to deal with getting the selected option and loading the game from the file private void buttonOK_Click(object sender, EventArgs e) { //load the game by file name in game form GameForm loadGame = new GameForm(comboFiles.SelectedItem.ToString()); //show the loaded game form loadGame.Show(); //dispose this load menu form this.Dispose(); }
//on click button ok event private void buttonOK_Click(object sender, EventArgs e) { //default caluse of size and rate int size = 20; int rate = 240; //Check if new information in the text boxes different to empty string get that info as size and rate if(sizeText.Text.ToString()!= "") size = (int)Convert.ToDouble(sizeText.Text.ToString()) + 1; //rate entered by the user in seconds but used in the game as milliseconds thus multiplication of the number by 60 if(genRateText.Text.ToString() != "") rate = ((int)(Convert.ToDouble(genRateText.Text.ToString()) + 1))* 60 ; //creates a new game form with the new size and rate GameForm theGame = new GameForm(size, rate); //show the new game form to start playing theGame.Show(); this.Dispose(); }