private void solveButton_Click(object sender, EventArgs e) { if (CountGrid(GetGrid()) < 10) { MessageBox.Show("Please fill in atleast 10 fields. The program would run with less but would take an extremely long time", "Too few inputs", MessageBoxButtons.OK); return; } Stopwatch sw = new Stopwatch(); sw.Start(); Grid grid = new Grid(GetGrid(), parallelCheckBox.Checked); grid.Solve(); setGrid(Grid.currentGrid); if (!Grid.IsValidGrid(Grid.currentGrid)) { solved = grid.BruteForceSolve(); if (solved.Count > 0) { setGrid(solved[0]); if (solved.Count > 1) { NextButton.Enabled = true; } index = 0; } CountLabel.Text = solved.Count.ToString(); } else { CountLabel.Text = "1"; } sw.Stop(); timeLabel.Text = sw.Elapsed.ToString(); }