Code: Select all
#Macro MakeProperty(fieldname, start, length, retType)
#If retType = "s"
Property tProduct.fieldname As String 'for reading
Return Mid(this.record, start, length)
End Property
Property tProduct.fieldname(v As String) 'for writing
Dim As String s
s = v + String(length, " ")
s = Left(s, length)
Mid(this.record, start, length) = s
End Property
#ElseIf retType = "i"
Property tProduct.fieldname As Integer 'for reading
Dim As String s
s = Mid(this.record, start, length)
s = LTrim(s, Chr(0))
Return Val(s)
End Property
Property tProduct.fieldname(v As Integer) 'for writing
Dim As String s
s = Str(v)
s = String(4, Chr(0)) + s
s = Right(s, 4)
Mid(this.record, start, 4) = s
End Property
#EndIf
#EndMacro
Edit:
I vaguely remember there was some issue with incorrect submitted 'SPACE's here in the forum. Maybe it helps to delete and reinsert it or replace it with CHR(32).