This is my home page for my application.The design is simple but i like it.For those who want to try to do this home loan calculator,i can share with you all the coding.
Here the coding for this form :
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form7.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Form7.Show()
Me.Hide()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim out As String
out = MsgBox("Are you sure want to QUIT from this system?", MsgBoxStyle.YesNo)
If out = vbYes Then
Dispose()
Me.Hide()
End If
End Sub
Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Form8.Show()
Me.Hide()
End Sub
End Class
This is my second page for my project and here is the coding :
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If cbhouse.Text = "single-storey house" Then
Form3.Show()
End If
If cbhouse.Text = "double-storey house" Then
Form4.Show()
End If
If cbhouse.Text = "Bungalow" Then
Form5.Show()
End If
If cbhouse.Text = "Condominium" Then
Form6.Show()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
End Class
This is my home loan calculator and here the coding for all event that have in this form.
Public Class Form7
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
txtLoanAmount.Clear()
txtDisplay1.Clear()
txtDisplay2.Clear()
lblMonthlyPayment.Text = ""
optTypesOfHouse1.Checked = True
dgvLoanDetails.Rows.Clear()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Print As String
Print = MsgBox("The table has been print")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim LoanAmount As Double
Dim Payment As Double
Dim InterestRate As Double
Dim Interest As Double
Dim Principle As Double
Dim Years As Integer
Dim PaymentPeriods As Integer
'validate loan amount,annual interest rate & loan period input
If IsNumeric(txtLoanAmount.Text) = False Then
MsgBox("Loan amount must be numeric. Please enter a validloan amount.")
txtLoanAmount.Clear()
txtLoanAmount.Focus()
Exit Sub
End If
If IsNumeric(txtDisplay1.Text) = False Then
MsgBox("Loan amount must be numeric. Please enter a validloan amount.")
txtDisplay1.Clear()
txtDisplay1.Focus()
Exit Sub
End If
If IsNumeric(txtDisplay2.Text) = False Then
MsgBox("Loan amount must be numeric. Please enter a validloan amount.")
txtDisplay2.Clear()
txtDisplay2.Focus()
Exit Sub
End If
'set loan variables
LoanAmount = txtLoanAmount.Text
InterestRate = txtDisplay1.Text
Years = txtDisplay2.Text
'calculate total payment periods
PaymentPeriods = Years * 12
'if rate is in percent form convert to decimal
If InterestRate > 1 Then InterestRate = InterestRate / 100
'calculate monthly payment and return value
Payment = (LoanAmount * Math.Pow((InterestRate / 12) + 1, (PaymentPeriods)) * InterestRate / 12) / (Math.Pow(InterestRate / 12 + 1, (PaymentPeriods)) - 1)
'display calculated payment
lblMonthlyPayment.Text = FormatCurrency(Payment)
'clear datagrid view control (remove all rows)
dgvLoanDetails.Rows.Clear()
'loop the loan payment periods displaying loan details
Dim i As Integer
For i = 1 To PaymentPeriods
'set interest
Interest = (LoanAmount * InterestRate) / 12
'set loan amount
LoanAmount = (LoanAmount - Payment) + Interest
'set principle
Principle = Payment - Interest
'output loan details
dgvLoanDetails.Rows.Add()
dgvLoanDetails.Item("Month", i - 1).Value = i
dgvLoanDetails.Item("Payment", i - 1).Value = FormatCurrency(Payment)
dgvLoanDetails.Item("Interest", i - 1).Value = FormatCurrency(Interest)
dgvLoanDetails.Item("Principle", i - 1).Value = FormatCurrency(Principle)
dgvLoanDetails.Item("LoanAmount", i - 1).Value = FormatCurrency(LoanAmount)
Next
End Sub
Private Sub dgvLoanDetails_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvLoanDetails.CellContentClick
End Sub
End Class
Here is the last form that have in my application Home Loan Calculator.This is simple calculator and i put some coding for you all so you all can try to make it and for beginner that want try VB,you all can try this project and learn some coding inside.For more detail about Visual Basic,you all can search in Home And Learn.co.uk
Public Class Form8
Dim sngNumberOne As Single
Dim sngNumberTwo As Single
Dim sngAnswer As Single
Dim strTodo As String
Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click
txtMain.Text = txtMain.Text & btn0.Text 'Show "0" in the Text Box
End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
txtMain.Text = txtMain.Text & btn1.Text 'Show "1" in the Text Box
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
txtMain.Text = txtMain.Text & btn2.Text 'Show "2" in the Text Box
End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
txtMain.Text = txtMain.Text & btn3.Text 'Show "3" in the Text Box
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
txtMain.Text = txtMain.Text & btn4.Text 'Show "4" in the Text Box
End Sub
Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
txtMain.Text = txtMain.Text & btn5.Text 'Show "5" in the Text Box
End Sub
Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
txtMain.Text = txtMain.Text & btn6.Text 'Show "6" in the Text Box
End Sub
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
txtMain.Text = txtMain.Text & btn7.Text 'Show "7" in the Text Box
End Sub
Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
txtMain.Text = txtMain.Text & btn8.Text 'Show "8" in the Text Box
End Sub
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
txtMain.Text = txtMain.Text & btn9.Text 'Show "9" in the Text Box
End Sub
Private Sub btnMultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMultiply.Click
sngNumberOne = Val(Me.txtMain.Text) 'Multiply Number 1 and Number Two
txtMain.Text = ""
strTodo = "*"
End Sub
Private Sub btnDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDivide.Click
sngNumberOne = Val(Me.txtMain.Text) 'Divide Number 1 and Number Two
txtMain.Text = ""
strTodo = "/"
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
sngNumberOne = Val(Me.txtMain.Text) 'Add Number 1 and Number Two
txtMain.Text = ""
strTodo = "+"
End Sub
Private Sub btnSubstract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubstract.Click
sngNumberOne = Val(Me.txtMain.Text) 'Substract Number 1 and Number Two
txtMain.Text = ""
strTodo = "-"
End Sub
'----------------------------------------------------------------------------
' Answer all the Number with the help of Aritmetic Progression
'----------------------------------------------------------------------------
Private Sub btnEqual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEqual.Click
sngNumberTwo = Val(Me.txtMain.Text)
If strTodo = "+" Then
Me.txtMain.Text = sngNumberOne + sngNumberTwo
ElseIf strTodo = "-" Then
Me.txtMain.Text = sngNumberOne - sngNumberTwo
ElseIf strTodo = "/" Then
Me.txtMain.Text = sngNumberOne / sngNumberTwo
ElseIf strTodo = "*" Then
Me.txtMain.Text = sngNumberOne * sngNumberTwo
End If
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtMain.Text = "0" 'Clear all the text from the text Box
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.Show()
Me.Hide()
End Sub
End Class
THANKS-DEXNER-
skip to main |
skip to sidebar
Write.Share.Comment
Friday, October 8, 2010
Followers
Powered by Blogger.
PLEASE FOLLOW ^_^
When one door closes, another opens; but we often look so long and so regretfully upon the closed door that we do not see the one that has opened for us. - Alexander Graham Bell
Feedjit
ChatBox
web hosting murah
1 Comments To Dexner:
Read your blog its really informative and helpful keep updating with newer post on Home loan interest calculator
Post a Comment