B
baret bonden
Trying to learn OOP. Pasted some MS example code inside a form class(but of
course made the test class outside of the form class);
I get "declaration epected" pointing to"Currentsale" ; this is the same
error I get with my own test code....
Dim CurrentSale As New SalesRecord
CurrentSale.CustomerName = "Matthew"
Public Class SalesRecord
Private _CustomerName As String
Private _Total As Decimal
Public Property CustomerName() As String
Get
Return _CustomerName
End Get
Set(ByVal Value As String)
_CustomerName = Value
End Set
End Property
Public Property Total() As Decimal
Get
Return _Total
End Get
Set(ByVal Value As Decimal)
If Value >= 0 Then
_Total = Value
Else
' Raise an error here.
End If
End Set
End Property
Public Function EstimateLatePaymentCost(ByVal _
YearsLate As Single) As Decimal
' Assuming 5%/year late payment fee.
Return (_Total * (1 + YearsLate * 0.05))
End Function
End Class
course made the test class outside of the form class);
I get "declaration epected" pointing to"Currentsale" ; this is the same
error I get with my own test code....
Dim CurrentSale As New SalesRecord
CurrentSale.CustomerName = "Matthew"
Public Class SalesRecord
Private _CustomerName As String
Private _Total As Decimal
Public Property CustomerName() As String
Get
Return _CustomerName
End Get
Set(ByVal Value As String)
_CustomerName = Value
End Set
End Property
Public Property Total() As Decimal
Get
Return _Total
End Get
Set(ByVal Value As Decimal)
If Value >= 0 Then
_Total = Value
Else
' Raise an error here.
End If
End Set
End Property
Public Function EstimateLatePaymentCost(ByVal _
YearsLate As Single) As Decimal
' Assuming 5%/year late payment fee.
Return (_Total * (1 + YearsLate * 0.05))
End Function
End Class