OK, it's the newbie to programming. I have written a program to calcuate and display the montly payment and total interest paid on a loan. I have to put in a note that says if interest rate is below .06 that "Interest Rate Must Be 6% or higher." I don't have a problem with the message but after the message is displayed and I hit ok, it still calculates the amount. How do I get it to either, return to program to input new interest rate then complete program: Code is as follows:Code:Public Class frmLoan Private Sub btnAnalyze_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAnalyze.Click Dim p, r, n, payment, ti As Double ' Set MSGbox if percentage is off If r < 0.06 Then MsgBox("Interest rate must be 6 percent or higher", MsgBoxStyle.Exclamation, "WARNING") Else End If 'set value parameters for calculation p = CDbl(txtloan.Text) r = CDbl(txtRate.Text) / 12 n = CDbl(txtLength.Text) ' duration of loan payment = (p * r) / (1 - (1 + r) ^ (-n)) ti = (n * payment) - p 'display results from formula calculations With lstResults.Items .Clear() .Add("Total monthly pay is " & (FormatCurrency(payment) & ".")) .Add("") .Add("Total interest is paid is " & (FormatCurrency(ti) & ".")) End With End Sub End Class




Reply With Quote