i cant display the items needed in the datagridview.
heres the error.
do i still need to make a mod connection?
here's my project.
http://www.mediafire.com/?hiu6ct88y79esii
Code:
Public Class Form1
Private Sub InterestPayment()
Dim intAmount As Double = 0
Dim principal As Double = Me.txtPrincipal.Text
Dim intInterestRate As Double = Me.txtInterest.Text
Dim principalPayment As Double = 0
intAmount = (principal * intInterestRate * 0.01) / 12
principalPayment = principal / CDbl(Me.txtPeriod.Text)
txtMonthlyInterestPayment.Text = FormatCurrency(intAmount, 2)
Me.txtMonthlyPrincipalPayment.Text = principalPayment
Dim intPay As Double = CDbl(Me.txtMonthlyInterestPayment.Text)
Dim principalpay As Double = Me.txtMonthlyPrincipalPayment.Text
Dim TotalPayment As Double = intPay + principalpay
Me.txtTotalPayment.Text = FormatCurrency(TotalPayment, 2)
End Sub
Private Sub btnCalculation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculation.Click
If Not IsNumeric(Me.txtPrincipal.Text) Then
MsgBox("Invalid principal value.", MsgBoxStyle.Exclamation, "Invalid Value.")
Return
End If
If Not IsNumeric(Me.txtPeriod.Text) Then
MsgBox("Invalid period value.", MsgBoxStyle.Exclamation, "Invalid Period.")
Return
End If
If Not IsNumeric(Me.txtInterest.Text) Then
MsgBox("Invalid interest rate value.", MsgBoxStyle.Exclamation, "Invalid Interest Rate.")
Return
End If
If Not IsNumeric(Me.txtid.Text) Then
MsgBox("Invalid id value.", MsgBoxStyle.Exclamation, "Please user numbers only.")
Return
End If
InterestPayment()
End Sub
Public Class Schedule
Dim dPrincipal As Double = 0
Dim dIntInterestRate As Double = 0
Dim iPeriod As Integer
Dim dtValueDate As Date
Dim sType As String = ""
Private Sub GenerateScheule()
Dim monthlyInt As Double = 0
Dim monthlyPrincipal As Double = 0
Dim dtDate As Date
Dim total As Double
monthlyInt = (dPrincipal * dIntInterestRate * 0.01) / 12
monthlyPrincipal = dPrincipal / iPeriod
For i As Integer = 1 To iPeriod
dtDate = dtValueDate.AddMonths(i)
total = monthlyPrincipal + monthlyInt
Form1.dgvLoanSchedule.Rows.Add(i, Format(dtDate, "dd/MMM/yyyy"), FormatCurrency(monthlyInt, 2), FormatCurrency(monthlyPrincipal, 2), FormatCurrency(total, 2))
dPrincipal -= monthlyPrincipal
monthlyPrincipal = dPrincipal / iPeriod
monthlyInt = (dPrincipal * dIntInterestRate * 0.01) / 12
Next
End Sub
Private Sub btnSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSchedule.Click
GenerateScheule()
End Sub
Public WriteOnly Property Principal() As Double
Set(ByVal value As Double)
dPrincipal = value
End Set
End Property
Public WriteOnly Property InterestRate() As Double
Set(ByVal value As Double)
dIntInterestRate = value
End Set
End Property
Public WriteOnly Property Period() As Double
Set(ByVal value As Double)
iPeriod = value
End Set
End Property
Public WriteOnly Property ValueDate() As Date
Set(ByVal value As Date)
dtValueDate = value
End Set
End Property
Public WriteOnly Property LoanType() As String
Set(ByVal value As String)
sType = value
End Set
End Property
End Class
End Class
Code:
Private Sub btnSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSchedule.Click
GenerateScheule()
here's my project.
http://www.mediafire.com/?hiu6ct88y79esii