Ejemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     newGame             = new GuessingGame();
     lblGuessResult.Text = "";
     newGame.StartRound();
 }
Ejemplo n.º 2
0
 private void btnCheckGuess_Click(object sender, EventArgs e)
 {
     try
     {
         if (newGame.CheckAnswer(int.Parse(txtUserGuess.Text)))
         {
             lblGuessResult.Text = $"Congratulations you guessed the number in {newGame.NumberOfGuesses} attempts.";
             newGame.StartRound();
         }
         else
         {
             lblGuessResult.Text = newGame.CheckGreaterThanLessThan();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Invalid data in the text box. Please input integer values only", "Error on input");
     }
 }