private void TxtTradeInValue_TextChanged(object sender, EventArgs e)
        {
            // New input clears error
            TradeInValueError.Clear();

            // If trade in value is modified, summary section outputs will be cleared.
            txtSummaryVehiclesSalePrice.Text = String.Empty;
            txtSummaryTradeIn.Text           = String.Empty;
            txtSummaryTax.Text        = String.Empty;
            txtSummarySubtotal.Text   = String.Empty;
            txtSummaryOptions.Text    = String.Empty;
            txtSummaryTotal.Text      = String.Empty;
            txtSummaryAmountDue.Text  = String.Empty;
            txtFinanceMonthlyPay.Text = String.Empty;
        }
 /// <summary>
 /// Validates trade in value input and throws appropriate error.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TradeInInput_Validated(object sender, EventArgs e)
 {
     if (txtTradeInValue.Text == null || txtTradeInValue.Text.Equals(String.Empty))
     {
         TradeInValueError.SetError(txtTradeInValue, "Trade-in value is a required field.");
     }
     else if (!Regex.IsMatch(txtTradeInValue.Text, @"^\d+$"))
     {
         TradeInValueError.SetError(txtTradeInValue, "Trade-in value cannot contain letters or special characters.");
     }
     else if ((!Regex.IsMatch(txtTradeInValue.Text, @"^\d+$") && Decimal.Parse(txtTradeInValue.Text) < 0))
     {
         TradeInValueError.SetError(txtTradeInValue, "Trade-in value cannot be less than 0.");
     }
     else if ((!Regex.IsMatch(txtTradeInValue.Text, @"^\d+$") && Decimal.Parse(txtVehiclesSalesPrice.Text) < Decimal.Parse(txtTradeInValue.Text)))
     {
         TradeInValueError.SetError(txtTradeInValue, "Trade-in value cannot exceed the vehicle sale price.");
     }
     else if (IsValidTradeInValue())
     {
         TradeInValueError.Clear();
     }
 }
        private void BtnReset_Click(object sender, EventArgs e)
        {
            string            messageConfirmation = "Do you want to reset the form?";
            string            caption             = "Reset Form";
            MessageBoxButtons button     = MessageBoxButtons.YesNo;
            MessageBoxIcon    boxIcon    = MessageBoxIcon.Warning;
            DialogResult      messageBox = MessageBox.Show(messageConfirmation, caption, button, boxIcon, MessageBoxDefaultButton.Button2);

            if (messageBox == DialogResult.Yes)
            {
                // Changes the form's initial state.
                txtVehiclesSalesPrice.Text = String.Empty;
                txtTradeInValue.Text       = "0";
                VehicleSalePriceError.Clear();
                TradeInValueError.Clear();

                chkComputerNavigation.Checked = false;
                chkLeatherInterior.Checked    = false;
                chkStereoSystem.Checked       = false;

                radStandard.Checked   = true;
                radPearlized.Checked  = false;
                radCustomized.Checked = false;

                nudFinanceInterestRate.Value = 5;
                nudFinanceYears.Value        = 1;

                txtSummaryVehiclesSalePrice.Text = String.Empty;
                txtSummaryTradeIn.Text           = String.Empty;
                txtSummaryTax.Text        = String.Empty;
                txtSummarySubtotal.Text   = String.Empty;
                txtSummaryOptions.Text    = String.Empty;
                txtSummaryTotal.Text      = String.Empty;
                txtSummaryAmountDue.Text  = String.Empty;
                txtFinanceMonthlyPay.Text = String.Empty;
            }
        }