Properties
19.05.2005 00:14:59
Gernot
Hallo Leute,
VBA gut ist etwas übertrieben.
was ist hier faul, müßte eigentlich laufen:
In einem Modul:
Sub State_Rabatt()
Dim P As Properties
Set P = New Properties
P.V_Name = "Gernot"
P.N_Name = "von Gehlen"
MsgBox P.V_Name
MsgBox P.FullName
P.Rabatt = 1
End Sub
In einem Klassenmodul:
Private FV_Name As String
Private FN_Name As String
Private FRabatt As Double
Public Property Get V_Name() As String
V_Name = FV_Name
End Property
Public Property Let V_Name(ByVal Wert As String)
FV_Name = Wert
End Property
Public Property Get N_Name() As String
N_Name = FN_Name
End Property
Public Property Let N_Name(ByVal Wert As String)
FN_Name = Wert
End Property
Public Property Get FullName() As String
FullName = FV_Name & " " & FN_Name
End Property
Private Sub Class_Initialize()
V_Name = "empty"
End Sub
Private Sub Class_Terminate()
V_Name = "done"
End Sub
Public Property Let Rabatt(ByVal Wert As Double)
If Wert < 0 Or Wert > 0.1 Then
Call Err.Raise(513, , "Rabatt muss größer 0 und kleiner 0,1 sein!")
End If
FRabatt = Wert
End Property
Grüße Gernot