Public
Class UserControl1
Private _years As
Double
Private _principle As
Double
Private _intRate As
Double
Private _Interest As
Double
Private _msg As
String = "Interest Not Calculated!"
Public Event
pple(ByVal validate As
Boolean)
Public Event
yrs(ByVal validate As
Boolean)
Public Event
rate(ByVal validate As
Boolean)
Public ReadOnly
Property msg() As
String
Get
Return _msg
End Get
End Property
Public Property
years() As Double
Get
Return _years
End Get
Set(ByVal value
As Double)
_years = value
End Set
End Property
Public Property
principle() As Double
Get
Return _principle
End Get
Set(ByVal value
As Double)
_principle = value
End Set
End Property
Public Property
intRate() As Double
Get
Return _intRate
End Get
Set(ByVal value
As Double)
_intRate = value
End Set
End Property
Public ReadOnly
Property Interest() As
Double
Get
Return _Interest
End Get
End Property
Public Sub
CalculateInterest()
CkVal(_principle, _years, _intRate)
End Sub
Private Sub
CkVal(ByVal pple As
Double, ByVal
years As Double,
ByVal rate As Double)
If pple < 100 Then
RaiseEvent pple(True)
Exit Sub
End If
If years < 2 Then
RaiseEvent yrs(True)
Exit Sub
End If
If rate < 5 Then
RaiseEvent rate(True)
Exit Sub
End If
_Interest = principle * _years * _intRate / 100
_msg = Convert.ToString(_Interest)
End Sub
End
Class