private void clearErrorProvider()
 {
     try
     {
         errorProvider1.SetError(txtMortgageAmount, "");
         errorProvider1.SetError(txtInterestRate, "");
         errorProvider1.SetError(txtMortgageTerm, "");
         errorProvider1.SetError(rtfAmortTable, "");
     }
     catch (System.Exception ex)
     {
         InputUtilities.clearException(ex);
     }
 }
        private void txtInput_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            TextBox txtBox;

            //if a navigation key do not react
            try
            {
                txtBox = (TextBox)(sender);
                if (InputUtilities.isNavigationKey(e))
                {
                    errorProvider1.SetError(txtBox, "");
                    //allow navigation keys to be entered
                    nonNumberEntered = false;
                    e.Handled        = false;
                }
                else if (InputUtilities.isNumericKey(e))
                {
                    errorProvider1.SetError(txtBox, "");
                    nonNumberEntered = false;
                    e.Handled        = false;
                }
                else
                {
                    string errorMessage = "Please enter only numeric values for the " + txtBox.Tag;
                    errorProvider1.SetError(txtBox, errorMessage);
                    //stop value form being entered since it is non-numeric
                    nonNumberEntered = true;
                    e.Handled        = true;
                }
            }
            catch (Exception ex)
            {
                //do nothing, catch the error later before calculations are done
                InputUtilities.clearException(ex);
            }
        }