I need to make this click event object oriented using a class with 3 instances variables.. Here I have the code...just need help on putting everything together to make work properly...THANKS in advance...
CODE
ption Explicit On
Imports System.Globalization
Public Class MainForm
'declare instance variables of Mainform
Private myCurrent As Loan
Private myRate As Loan
Private myNper As Loan
Private isConverted As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'instantiate an objects
myCurrent = New Loan()
myRate = New Loan()
MyNper = New Loan()
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub
Private Sub ResetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetButton.Click
principalTextBox.Clear()
IntTextBox.Clear()
TermTextBox.Clear()
End Sub
Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click
Dim Rate As Decimal
Dim Nper As Double
Dim PV As Double
Dim CalculateTotal As Loan
Dim value As Decimal
Dim total As Decimal
Dim Current As Double
' Setting the values to each of our variables.
Rate = value
Nper = 4
PV = value
If isConverted Then
'calculate total
total = CalculateTotal()
PaymentsLabel.Text = total
End If
End Sub
End Class
[/code
[code]
Public Class Loan
'instance variables
Private _current As Decimal
Private _rate As Decimal
Private _nper As Decimal
' constructor
Public Sub New(Optional ByVal theCurrent As Decimal = 0, _
Optional ByVal theRate As Decimal = 0, _
Optional ByVal theNper As Decimal = 0)
_current = theCurrent
_rate = theRate
_nper = theNper
End Sub
'Property procedures
Public Property Current() As Decimal
Get
Return _current
End Get
Set(ByVal value As Decimal)
_current = value
End Set
End Property
'Property procedures
Public Property Rate() As Decimal
Get
Return _rate
End Get
Set(ByVal value As Decimal)
_rate = value
End Set
End Property
'Property procedures
Public Property Nper() As Decimal
Get
Return _nper
End Get
Set(ByVal value As Decimal)
_nper = value
End Set
End Property
Public Function CalculateTotal() As Decimal
Return -Financial.Pmt(Rate, Nper, Current)
End Function
End Class