3 Replies - 7539 Views - Last Post: 13 December 2013 - 01:49 PM Rate Topic: -----

#1 peper  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-December 13

Vehicle Loan Calculator

Posted 13 December 2013 - 08:39 AM

I found you guys a couple days ago and today signed up Thank-you
I feel this is a really great place and Im going to just throw something out here.
Its a month ago I first heard of pseudocoad and my life has been hel ever since. Im kidding,however difficult seems to be my word of the day. On this project Iv yet to get the ListBox or my lblAnnualRate to work properly. My btnCalculate for the most part did work untill I kept working on it.ugg Anyone who has knowladge, general or specific please share. I injoy coding I am apparently just very slow. Thankx The whole package is zip at the bottom of the page. Thanks again

Attached File  cc1.zip (209.15K)
Number of downloads: 300

Public Class Form1

    Dim dblPrincipal As Object
    Dim Array As String
    Dim Principal As Object

    Private Property dblAnnualRate As Object

    Private Property dblNEW_RATE As Object

    Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter
        ' Class-level constants
        Const dblMONTHS_Year As Double = 12        'Months per year
        Const dblNEW_RATE As Double = 0.089        'Interest rate , new cars
        Const dblUSED_RATE As Double = 0.095       'Interest rate , used cars

        ' Class level varibale to hold the annual interest rate AND...
        Dim dblAnnualRate As Double = dblNEW_RATE

    End Sub

    Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
        ' Calculate
    End Sub
    Private Async Function DoSomethingAsync() As Task
        Dim delayTask As Task(Of Integer) = DelayAsync()
        Dim result As Integer = Await delayTask

        Dim dblVehicleCost As Double       ' Vehicle Cost
        Dim dblDownPayment As Double        ' Down Payment
        Dim intMonths As Integer            ' Number of months for the lone
        Dim dblLone As Double               ' Amount of the lone
        Dim dblMonthlyPayment As Double     ' Monthly Payment
        Dim dblInterest As Double           ' Interest paid for the period
        Dim dblInterestIn As Double         ' Principal paid for the period
        Dim intCount As Integer             ' Counter for the loop
        Dim strOut As String                ' Used to hold a line of output
        Dim dblAnnualRate As Double
        Dim dblLoan As Double
        Dim dblMONTHS_YEAR As Double
        Dim dblPrincipal As Double

        ' Get the vehicle cost.
        If Double.TryParse(txtCost.Text, dblVehicleCost) Then

            ' Get the down payment.
            If Double.TryParse(txtDownPayment.Text, dblDownPayment) Then

                ' Get the number of months.
                If Integer.TryParse(txtMonths.Text, intMonths) Then

                    ' Calulate the amount of the lone
                    dblLone = (dblVehicleCost - dblDownPayment)

                    ' Calculate the monthly payments
                    dblMonthlyPayment = Pmt(dblAnnualRate / dblMONTHS_YEAR,
                                           intMonths, -dblLoan)
                    ' Clear the list box

                    For intCount = 1 To intMonths

                    ' Calculate the interest for the period.
                    dblInterest = Pmt(dblAnnualRate / dblMONTHS_YEAR,
                   intCount, intMonths, -dblLoan)

                    ' Start building the output string with the month.
                    strOut = "Month: " & intCount.ToString()

                    ' And the payment amount to the output string.
                    strOut &= "Payment: " & dblPrincipal.ToString("c")

                    ' Add the interest amount to the output string.
                    strOut &= "Interest: " & dblInterestIn.ToString("c")

                    ' Add the principle for the period.
                    strOut &= Principal.ToString(CInt("c"))

                    ' Add the output string to the list box.

                    ' Error message for invalid months.
                    MessageBox.Show("Enter a integer for months.")
                End If
                ' Error message for an invalid down payment.
                MessageBox.Show("Enter a numeric value for the down payment")
            End If
            ' Error message for invalid vehicle cost.
            MessageBox.Show("Enter a numeric value for the vehicle cost")
        End If
    End Function

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
        ' Reset the interst rate, clear the text boxs.
        ' and clear the list box. Set default interest
        ' rate for new car loans.

        radNew.Checked = True
        lblLable = CType(dblNEW_RATE, Label)


        ' Reset the focus to txtCost.
    End Sub

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        ' Close the form.
    End Sub

    Private Function DelayAsync() As Task(Of Integer)
        Throw New NotImplementedException
    End Function

End Class

This post has been edited by modi123_1: 13 December 2013 - 08:50 AM
Reason for edit:: highlight your text and click the 'code' button

Is This A Good Question/Topic? 0
  • +

Replies To: Vehicle Loan Calculator

#2 andrewsw  Icon User is online

  • Beach ready
  • member icon

Reputation: 5468
  • View blog
  • Posts: 21,513
  • Joined: 12-December 12

Re: Vehicle Loan Calculator

Posted 13 December 2013 - 10:34 AM

This is VB.NET, not VB6. Topic moved.

What is your specific problem and question?

Does your code work? If not, what errors do you receive?
Was This Post Helpful? 0
  • +
  • -

#3 TheCrazy8th  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 16
  • Joined: 14-October 13

Re: Vehicle Loan Calculator

Posted 13 December 2013 - 12:33 PM

I don't see what the point of this post is...Is this supposed to be a learning tutorial? Probelm you are having with said program? If so; with what? What errors do you get? I don't see anything wrong with it so far (quick glance over the code) so I am confused as to the point of this post.
Was This Post Helpful? 0
  • +
  • -

#4 DarenR  Icon User is online

  • D.I.C Lover

Reputation: 540
  • View blog
  • Posts: 3,630
  • Joined: 12-January 10

Re: Vehicle Loan Calculator

Posted 13 December 2013 - 01:49 PM

you need to ask a question or state a problem and your error codes
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1