private void NewGameButton_Click(object sender, EventArgs e) // Start a new game button click { try { int gridRow = int.Parse(gridsizeTextBoxRow.Text); // Gets the number of rows for the grid int gridColumn = int.Parse(gridsizeTextBoxColumn.Text); // Gets the number of columns for the grid NewGameButton.Visible = false; // New Game Button not visible once clicked SubGuessButton.Enabled = true; // Guess button enabled scan = new ScanAnalyzer(gridRow, gridColumn, this); // intantiate the scanner class with this gameTextBox.Visible = true; counterLabel.Text = Convert.ToString(scan.GuessCounter); counterLabel.Visible = true; } // throw and catch exception catch (Exception ex) { if (ex.ToString().Contains("Check the fields again")) // If any textboxes are empty { MessageBox.Show("Please make sure you have all the fields entered correctly"); // print message } else { MessageBox.Show(ex.ToString()); } } }
public FindSampleGame() { InitializeComponent(); //pictureBox1.Image = Image.FromFile("GridSquare.jpg"); SubGuessButton.Enabled = false; // Guess button disabled after program loads // DisplayPanel.Visible = true; // Game text box visible // move to where a button is being clicked scan = new ScanAnalyzer(4, 4, Point[] { }, "GridSquare.jpg" /*, this*/); // intantiate the scanner class with this