Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,549 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,578 people online right now. Registration is fast and FREE... Join Now!




MortgageCalculator

 
Reply to this topicStart new topic

MortgageCalculator, Nothing works

mprather13
24 Nov, 2007 - 09:06 AM
Post #1

New D.I.C Head
*

Joined: 17 Nov, 2007
Posts: 2


My Contributions
CODE
Public Class MortgageCalculatorForm

   Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
      Dim years As Integer = 2            'repetition counter
      Dim mortgageAmount As Integer = 0   'house price
      Dim interest As Double = 0          'interest rate
      Dim monthlyPayment As Decimal = 0   'monthly payment
      Dim monthlyInterest As Double = 0   'monthly interest rate

      '  remove text displayed in ListBox
      paymentsListBox.Items.Clear()


      'add header to ListBox
      paymentsListBox.Items.Add("Mortgage Length (Years) & ControlChars.Tab & ControlChars.Tab & "Monthly Payment")

      'retrieve user input and assign values to their respective variables
      interest = Val(interestTextBox.Text) / 100
      monthlyPayment = Val(resultListBox.Text)

      'determine monthly interest rate
      monthlyInterest = interest / 12

      'loop six times
      Do While years <= 7
         'calculate payment perieod
         years = 5 * years

         'calculate monthly paryment
         monthlyPaymetn = Convert.ToDecimal(Pmt(monthlyInterest, years, mortgageAmount))

         'display payment amount
         paymentsListBox.Items.Add(months & ControlChars.Tab & ControlCharts.Tab 7 String.Format("{0:C}", monthlyPayment))

         years += 5  'increment counter
      Loop
   End Sub
End Class ' MortgageCalculatorForm

User is offlineProfile CardPM
+Quote Post

KeyWiz
RE: MortgageCalculator
25 Nov, 2007 - 11:14 AM
Post #2

D.I.C Regular
Group Icon

Joined: 26 Oct, 2006
Posts: 428


Dream Kudos: 125
My Contributions
For starters, check your spelling of variables
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:41PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month