Form Persegi_Panjang
(didapat dari class, klik kanan, add, add class, name = Persegi_Panjang)
Public Class Persegi_Panjang
Private Panjang As Integer
Private Lebar As Integer
'Konstruktor
Public Sub New()
Panjang = 0
Lebar = 0
End Sub
'Property
Public Property proppanjang()
Get
Return Panjang
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Panjang = value
Else
Panjang = 0
End If
End Set
End Property
Public Property proplebar()
Get
Return Lebar
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Lebar = value
Else
Lebar = 0
End If
End Set
End Property
Function Luas()
Return Panjang * Lebar
End Function
End Class
Form 1
Public Class Persegi_Panjang
Private Panjang As Integer
Private Lebar As Integer
'Konstruktor
Public Sub New()
Panjang = 0
Lebar = 0
End Sub
'Property
Public Property proppanjang()
Get
Return Panjang
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Panjang = value
Else
Panjang = 0
End If
End Set
End Property
Public Property proplebar()
Get
Return Lebar
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Lebar = value
Else
Lebar = 0
End If
End Set
End Property
Function Luas()
Return Panjang * Lebar
End Function
End Class
(didapat dari class, klik kanan, add, add class, name = Persegi_Panjang)
Public Class Persegi_Panjang
Private Panjang As Integer
Private Lebar As Integer
'Konstruktor
Public Sub New()
Panjang = 0
Lebar = 0
End Sub
'Property
Public Property proppanjang()
Get
Return Panjang
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Panjang = value
Else
Panjang = 0
End If
End Set
End Property
Public Property proplebar()
Get
Return Lebar
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Lebar = value
Else
Lebar = 0
End If
End Set
End Property
Function Luas()
Return Panjang * Lebar
End Function
End Class
Form 1
Public Class Persegi_Panjang
Private Panjang As Integer
Private Lebar As Integer
'Konstruktor
Public Sub New()
Panjang = 0
Lebar = 0
End Sub
'Property
Public Property proppanjang()
Get
Return Panjang
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Panjang = value
Else
Panjang = 0
End If
End Set
End Property
Public Property proplebar()
Get
Return Lebar
End Get
Set(ByVal value)
If IsNumeric(value) = True Then
Lebar = value
Else
Lebar = 0
End If
End Set
End Property
Function Luas()
Return Panjang * Lebar
End Function
End Class
0 komentar
Posting Komentar