Public Class Form1

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        Dim InterestRate, Years, FinalValue, MonthlyPayment As Double
        InterestRate = Val(txtInterestRate.Text)
        ' Poniższy wiersz jest wymagany, ale celowo wykomentowany w celu wywołania błędu
        ' Years = Val(txtYears.Text)
        FinalValue = Val(txtFutureValue.Text)
        MonthlyPayment = Pmt(InterestRate / 12 / 100, _
            Years * 12, 0, -FinalValue, _
                DueDate.BegOfPeriod)
        txtMonthlyInvestment.Text = MonthlyPayment.ToString("C")
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
