?
=?ISO-8859-1?Q?Bernard_Bour=E9e?=
I would like to achieve the following goal: design a class with a
default property called dVal where I could store and get a decimal value
WITHOUT the need to write the property.
I have the following code:
Dim Var as New VarDécimal
Var = 100 (instead of Var.dVal)
But I get an error telling me that a default property need to have a
parameter ! Why and what for ?
How to solve my problem ?
Thanks for your help
Bernard
Public Class VarDécimal
Private mNomVar As String
Private mVal As Decimal
Public Property Nom() As String
Get
Return mNomVar
End Get
Set(ByVal Value As String)
mNomVar = Value
End Set
End Property
Default Public Property dVal() As Decimal
Get
Return mVal
End Get
Set(ByVal Value As Decimal)
mVal = Value
End Set
End Property
End Class
default property called dVal where I could store and get a decimal value
WITHOUT the need to write the property.
I have the following code:
Dim Var as New VarDécimal
Var = 100 (instead of Var.dVal)
But I get an error telling me that a default property need to have a
parameter ! Why and what for ?
How to solve my problem ?
Thanks for your help
Bernard
Public Class VarDécimal
Private mNomVar As String
Private mVal As Decimal
Public Property Nom() As String
Get
Return mNomVar
End Get
Set(ByVal Value As String)
mNomVar = Value
End Set
End Property
Default Public Property dVal() As Decimal
Get
Return mVal
End Get
Set(ByVal Value As Decimal)
mVal = Value
End Set
End Property
End Class