CharlieMay, on 20 March 2013 - 08:24 AM, said:
I'm afraid that without me actually just fixing the code you supplied in your first post, that it's doesn't get much easier than what I just explained.
Have you even tried putting that information into your Schedule Button?
Here's a tip, don't copy and paste it, type it in there and when you get to the second line to the point of typing ASchedule. you should have an eye-opening experience as to what you need to do.
If that's not enough, then I suggest you go to the VB.Net FAQ & Resources topic that AdamSpeight2008 has pinned to the top of the forum and work through the first entry "Just Started VB.Net? Stuck?" because it appears there's a lot of the basics that you're not understanding yet.
Have you even tried putting that information into your Schedule Button?
Here's a tip, don't copy and paste it, type it in there and when you get to the second line to the point of typing ASchedule. you should have an eye-opening experience as to what you need to do.
If that's not enough, then I suggest you go to the VB.Net FAQ & Resources topic that AdamSpeight2008 has pinned to the top of the forum and work through the first entry "Just Started VB.Net? Stuck?" because it appears there's a lot of the basics that you're not understanding yet.
i already figure it out.
i remove the class
so there will be only a single class.
heres the 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
InterestPayment()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Dim dPrincipal As Double = 0
Dim dIntInterestRate As Double = 0
Dim iPeriod As Integer
Dim dtValueDate As Date
Dim sType As String = ""
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 Integer
Set(ByVal value As Integer)
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
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
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
End Class
no more error but still the schedule button dont generate the dates... still blank datagridview.
Private Sub btnSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSchedule.Click
GenerateScheule()
End Sub

New Topic/Question
Reply




MultiQuote




|