What's new

Help VB.net 2017 Mortgage Calculator

drian90

Eternal Poster
Joined
Oct 23, 2016
Posts
1,121
Reaction
245
Points
322
Hello good day mga sir. Pwedi po patulong sa project namin nahihirapan na ako diko makuha sa gusto ko na output. Willing po ako magbayad ng 200 load all network via Paymaya if ma solve po problema ko dito.

ito po sana gusto ko na output
584314


ito po yung original na nasa program na nadownload ko from sourcecodester kumbaga e revise ko lang po sa gusto ko na output
584327


ito po ang program - You do not have permission to view the full content of this post. Log in or register now.

Maraming salamat po
 

Attachments

So you have an output already. If you need to output from 5 years to 30 years per 5 year interval, why dont you just compute the mortgage 6 times (5 years, 10 yeqrs, 15 years etc) based on the mortgage formula (I assume you got the right formula).

Then concatenate the results and delimited by a newline character.
 
So you have an output already. If you need to output from 5 years to 30 years per 5 year interval, why dont you just compute the mortgage 6 times (5 years, 10 yeqrs, 15 years etc) based on the mortgage formula (I assume you got the right formula).

Then concatenate the results and delimited by a newline character.

Sir ito po code nahihirapan po talaga ako huhu


Private Sub btncalcpayment_Click(sender As Object, e As EventArgs) Handles btncalcpayment.Click
Dim Payment As Single
Dim LoanIRate As Single
Dim LoanDuration As Integer
Dim LoanAmount As Integer
' Validate amount
If IsNumeric(txtamnt.Text) Then
LoanAmount = txtamnt.Text
Else
MsgBox("Please enter a valid amount")
Exit Sub
End If
' Validate interest rate
If IsNumeric(txtrate.Text) Then
LoanIRate = 0.01 * txtrate.Text / 12
Else
MsgBox("Invalid interest rate, please re-enter")
Exit Sub
End If
' Validate loan’s duration
If IsNumeric(txtduration.Text) Then
LoanDuration = txtduration.Text
Else
MsgBox("Please specify the loan’s duration as a number of months")
Exit Sub
End If
' If all data were validated, proceed with calculations

Payment = Pmt(LoanIRate, LoanDuration, -LoanAmount, 0)
RichTextBox1.Text = Payment.ToString("#.00") & vbCrLf

End Sub
 
I am not a VB guru because I am not fond of the language but my best bet is this

Dim Payment1 As Single
Dim Payment2 As Single
Dim Payment3 As Single
Dim Payment4 As Single
Dim Payment5 As Single

Payment1 = Pmt(LoanIRate, LoanDuration, -LoanAmount, 0)
Payment2 = Pmt(LoanIRate, LoanDuration-5, -LoanAmount, 0)
Payment3 = Pmt(LoanIRate, LoanDuration-10, -LoanAmount, 0)
Payment4 = Pmt(LoanIRate, LoanDuration-15, -LoanAmount, 0)
Payment5 = Pmt(LoanIRate, LoanDuration-20, -LoanAmount, 0)

RichTextBox1.Text = Payment1.ToString("#.00") & vbCrLf &
Payment2.ToString("#.00") & vbCrLf & Payment3.ToString("#.00") & vbCrLf & Payment4.ToString("#.00") & vbCrLf & Payment5.ToString("#.00") & vbCrLf

The problem with this code iss the repetition. You can simplify this probably with simpler function. Also I cant remember if Single means float in vb (like in Java or Number like in JavaScript).

Also double check the formula. I assume your fornula is correct
 
I am not a VB guru because I am not fond of the language but my best bet is this

Dim Payment1 As Single
Dim Payment2 As Single
Dim Payment3 As Single
Dim Payment4 As Single
Dim Payment5 As Single

Payment1 = Pmt(LoanIRate, LoanDuration, -LoanAmount, 0)
Payment2 = Pmt(LoanIRate, LoanDuration-5, -LoanAmount, 0)
Payment3 = Pmt(LoanIRate, LoanDuration-10, -LoanAmount, 0)
Payment4 = Pmt(LoanIRate, LoanDuration-15, -LoanAmount, 0)
Payment5 = Pmt(LoanIRate, LoanDuration-20, -LoanAmount, 0)

RichTextBox1.Text = Payment1.ToString("#.00") & vbCrLf &
Payment2.ToString("#.00") & vbCrLf & Payment3.ToString("#.00") & vbCrLf & Payment4.ToString("#.00") & vbCrLf & Payment5.ToString("#.00") & vbCrLf

The problem with this code iss the repetition. You can simplify this probably with simpler function. Also I cant remember if Single means float in vb (like in Java or Number like in JavaScript).

Also double check the formula. I assume your fornula is correct

Thank you so much sir. Try ko po. Godbless
 
JavaScript version

let payment;
let durations = [5, 10, 15, 20, 25, 30].
for(let duration of durations) {
payment += pmt(loanRate, duration, -loanAmount, 0) + '\n';
}
return payment

Way simpler and less verbose than VB. I programmed this at the top of my head so I might have some syntax issue here and there.
 
JavaScript version

let payment;
let durations = [5, 10, 15, 20, 25, 30].
for(let duration of durations) {
payment += pmt(loanRate, duration, -loanAmount, 0) + '\n';
}
return payment

Way simpler and less verbose than VB. I programmed this at the top of my head so I might have some syntax issue here and there.

I'm just a beginner sir. When I try to insert the code there's an error ayaw mag display mga numbers when I click the button to calculate.

584391

584392
 

Attachments

Last edited:
Ok I'm on my desktop computer now. I'd been responding previously from my mobile since I joined this forum.

Well, what's NPer? Post your entire source. Also the solution I provided is just meant for inspiration and not meant to really solve the problem you are having (but it may)
 
patingin nga nung Pmt na function? or di kaya post mo yung formula mo sa pagkuha ng interest rate. kasi parang hindi standard yung equation e. hindi ko makuha kung paano ka nag arrived ng 19,533.15 @ 5years.
 
Last edited:
Hi, the mortgage calculator is a great tool, I always use it to calculate the interest rate and find out whether it is profitable for me to pay off the mortgage faster or better to stretch it for another 5 years. But if I have any mortgage issues, I always consult with a specialist, because I know that in this case there is no room for mistakes, so as not to lose money. So, I have a personal You do not have permission to view the full content of this post. Log in or register now. who is available 24/7 and I am glad that I got his contacts, because he helped me reduce the interest rate and sort out paper issues.
 

Similar threads

Back
Top