hello everyone i need your help :
my problem is in the btnshedule i dont know why?
error :
my problem is in the btnshedule i dont know why?
error :
Code:
Error 1 'scheds' is not declared. It may be inaccessible due to its protection level. c:\documents and settings\pixel\my documents\visual studio 2010\Projects\WindowsApplication1\WindowsApplication1\Form1.vb 89 9 WindowsApplication1
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
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
InterestPayment()
End Sub
Private Class awer
Dim dPrincipal As Double = 0
Dim dIntInterestRate As Double = 0
Dim iPeriod As Double
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 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
Private Sub scheds()
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
End Class
Private Sub btnSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSchedule.Click
scheds()
End Sub
End Class