private void Solve_Click(object sender, EventArgs e) { Program.stopTimer(); Program.updateTime(); int min = Program.getMins(); int sec = Program.getS(); label8.Text = min.ToString(); label8.Text += "m "; label8.Text += sec.ToString(); label8.Text += "s"; label7.Visible = true; label8.Visible = true; int i = 0; //Control[] buttons = new Control[] { button1, button2, button3, button4, button5, button6, button7, button8, button9, button10, button11, button12, button13, button14, button15, button16, button17, button18, button19, button20, button21, button22, button23, button24, button25, button26, button27, button28, button29, button30, button31, button32, button33, button34, button35, button36, button37, button38, button39, button40, button41, button42, button43, button44, button45, button46, button47, button48, button49, button50, button51, button52, button53, button54, button55, button56, button57, button58, button59, button60, button61, button62, button63, button64, button65, button66, button67, button68, button69, button70, button71, button72, button73, button74, button75, button76, button77, button78, button79, button80, button81 }; foreach (Button b in buttons) { // b.Enabled = false; int result = Program.solve(arrBoard, arrSol, arrIndices, i); if (result != 0) { if (result != 2) { if (result == 1) { b.ForeColor = Color.Blue; } else if (result == 3) { b.ForeColor = Color.Red; } b.Text = arrSol[i].ToString(); } } i++; } Clear.Hide(); Save.Hide(); Solve.Hide(); NewGame.Show(); }