Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
' Fill list box with rates and select 3.0 rate.
For dblRates As Double = 2 To 7 Step 0.5
lstRates.Items.Add(dblRates.ToString("N1…
Next dblRates
lstRates.SelectedItem = "3.0"
End Sub
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
' Display the monthly mortgage payment.
Dim intPrincipal As Integer
Dim dblRate As Double
Dim dblPay As Double
Integer.TryParse(txtPrincipal.Text, intPrincipal)
Double.TryParse(lstRates.SelectedItem.To… DblRate)
dblRate = dblRate / 100
lblPay.Text = String.Empty
For intTerm As Integer = 15 To 30 Step 5
dblPay = -Financial.Pmt(dblRate / 12,
intTerm * 12, intPrincipal)
lblPay.Text = lblPay.Text & intTerm.ToString &
" years: " & dblPay.ToString("C2") &
ControlChars.NewLine
Next intTerm
End Sub
Read more: How would I change the For. Next statements to Do. Loop statements, VISUAL BASIC?