public void OnSubmit(object sender, EventArgs e) { try { int s = Int32.Parse(inputBox.Text); if (s < 0 || s > 999) { inputBox.Focus(); return; } inputBox.Text = ""; tracker.Submit(s); if (tracker.IsRunning()) { SwapControls(submit); } display.UpdateScores(); if (tracker.IsFinished()) { SwapControls(save); save.Focus(); return; } else { inputBox.Focus(); } } catch (Exception) { inputBox.Text = ""; inputBox.Focus(); } }