Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

I am not good at VB and need help with this code

Avatar of Eliana1
Eliana1 asked on
Visual Basic Classic
1 Comment1 Solution511 ViewsLast Modified:
I don't remeber how to invoke a method to a new object.  Here is the code my issues start at line 33
Private Sub findMortgagePayment()
        Dim prompt As String
        Dim validPV As Boolean = False
        Dim validAPR As Boolean = False
        Dim validTerm As Boolean = False
        Dim principal As Double
        Dim apr As Double
        Dim term As Integer

        Try
            '***********************************************************************
            'implement input validation and set local variables  here
            '***********************************************************************
            If validatePrincipalAmount() Then
                principal = Double.Parse(txtMortgageAmount.Text)
                validPV = True
            Else
                txtMortgageAmount.Clear()
            End If
            If validateInterestRate() Then
                apr = Double.Parse(txtInterestRate.Text)
                validAPR = True
            Else
                txtInterestRate.Clear()
            End If
            If validateTerm() Then
                term = Integer.Parse(txtMortgageTerm.Text)
                validTerm = True
            Else
                txtMortgageTerm.Clear()
            End If
           
            If validPV AndAlso validAPR AndAlso validTerm Then
                '***********************************************************************
                ' declare and create a new mortgage data object  
                ' invoke this class's displayPayment method
                ' invoke this class's displayAmoritizationTable method
                '***********************************************************************
                Dim mortgageData As MortgageData
                mortgageData = New MortgageData()



            Else
                lblAmount.Text = ""
                ToolTip1.SetToolTip(lblAmount, "")
                ToolTip1.SetToolTip(rtfAmortTable, "")
                If Not validPV Then
                    prompt = "Please re-enter the loan amount information and try again"
                    InputUtilities.ShowErrorMessage(prompt, "Invalid Loan value")
                    txtMortgageAmount.Focus()
                ElseIf Not validAPR Then
                    prompt = "Please re-enter the interest rate information and try again"
                    InputUtilities.ShowErrorMessage(prompt, "Invalid Interest rate value")
                    txtInterestRate.Focus()
                Else
                    prompt = "Please re-enter the term length information and try again"
                    InputUtilities.ShowErrorMessage(prompt, "Invalid Term value")
                    txtMortgageTerm.Focus()
                End If
            End If
        Catch ex As Exception
            prompt = "Please re-enter the loan information and try again"
            InputUtilities.ShowErrorMessage(ex, prompt)
            ClearFields()
        End Try
    End Sub

    Private Sub displayPayment(ByRef mortgage As MortgageData)
        lblAmount.Text = FormatCurrency(mortgage.Payment, 2)
        ToolTip1.SetToolTip(lblAmount, "Monthly payment is: " & lblAmount.Text)
    End Sub

    Private Sub displayAmortizationTable(ByRef mortgage As MortgageData)

        Dim tableOutput As String

        '***********************************************************************
        'create AmortizationTable here
        'retreive the Amoritization table
        '***********************************************************************

        rtfAmortTable.Text = tableOutput
        ToolTip1.SetToolTip(rtfAmortTable, "Amortization Table for " & mortgage.FullDataString)
    End Sub

#End Region
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric MoreauFlag of Canada imageSenior .Net Consultant
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers