-
Visual Basic 2008 Mortgage Calculator
Hi, I have a school project in which I must complete a mortgage calculator in Visual Basic. I have made the calculator, and it displays the result, but the only issue is that the value is incorrect. I am new to programming, so maybe someone could help me. Here is my code.
Public Class Form1
Dim InitialAmount, DownPayment, Interest, PaymentPeriod, Payment As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
InitialAmount = Val(TextBox1.Text)
DownPayment = Val(TextBox2.Text)
Interest = Val(TextBox3.Text)
PaymentPeriod = Val(TextBox4.Text)
Payment = Val(TextBox5.Text)
TextBox5.Text = Pmt(Interest, PaymentPeriod * 48, -InitialAmount)
End Sub
End Class
-
Wrong forum, you need the .NET forum...
-
Moved From Classic VB
The value is incorrect how?
-
 Originally Posted by Hack
Moved From Classic VB
The value is incorrect how?
For example, if I am supposed to recieve a monthly payment of $699.21, my payment on my calculator will say $750. It is usually about $50 off from the appropriate amount. Additionally, does someone know how I could incorporate down payment into the pmt formula?
-
Walk me through the process.
You have these textboxes:
Textbox1.Text
Textbox2.Text
Textbox3.Text
Textbox4.Text
Textbox5.Text
You have these variables:
InitialAmount
DownPayment
Interest
PaymentPeriod
Payment
You are doing this with them
Code:
InitialAmount = Val(TextBox1.Text)
DownPayment = Val(TextBox2.Text)
Interest = Val(TextBox3.Text)
PaymentPeriod = Val(TextBox4.Text)
Payment = Val(TextBox5.Text)
Now, I have $699.21 - what do I do with it? What textbox does it go in, and what happens to it after I put it there? How does your calculator arrive at $750? What is the math function that is performed on my $699.21?
-
 Originally Posted by Hack
Walk me through the process.
You have these textboxes:
Textbox1.Text
Textbox2.Text
Textbox3.Text
Textbox4.Text
Textbox5.Text
You have these variables:
InitialAmount
DownPayment
Interest
PaymentPeriod
Payment
You are doing this with them
Code:
InitialAmount = Val(TextBox1.Text)
DownPayment = Val(TextBox2.Text)
Interest = Val(TextBox3.Text)
PaymentPeriod = Val(TextBox4.Text)
Payment = Val(TextBox5.Text)
Now, I have $699.21 - what do I do with it? What textbox does it go in, and what happens to it after I put it there? How does your calculator arrive at $750? What is the math function that is performed on my $699.21?
When the result is calculated, it is displayed as TextBox5.Text. The formula I am using to calculate the monthly payment is:
TextBox5.Text = Pmt(Interest, PaymentPeriod * 48, -InitialAmount)
Since I am new to programming, I doubt this Pmt function is entirely correct, I just can't find what is wrong with it that always gives me a wrong result.
Similar Threads
-
By binnymann in forum Database
Replies: 3
Last Post: 04-17-2008, 01:20 PM
-
By Complete in forum VB Classic
Replies: 6
Last Post: 03-01-2006, 11:08 AM
-
By Constance J. Petersen in forum dotnet.announcements
Replies: 0
Last Post: 11-22-2002, 11:40 AM
-
By Constance J. Petersen in forum dotnet.announcements
Replies: 0
Last Post: 07-26-2002, 03:32 PM
-
By Paul R. Wilde in forum vb.announcements
Replies: 0
Last Post: 08-13-2000, 08:35 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|