You can validate the value sent in the Let procedure
to make sure it's a valid setting. Is that what you mean?
If you want to return a result you need to use a function.
Private Name1 as string
Public Property Let Name(sName as string)
'-- you can validate whether this incoming value is a relevant string
'-- but you need a function to return a result. In this case, you'll
'-- assign incoming value to property only if first letter is "m".
'-- If they send "tree" the property will not be set but they won't
'-- know that unless you raise an error.
if (len(sName) > 0) then
If Ucase$(Left$(sName, 1)) = "M" then Name1 = sName
end if
End Property
Public Property Get Name() as String
Name = Name1
End Property
I'm just starting out in VB so please be patient.
I am creating an activex control, in the class there is a single variable
that is to be validated when set. Currently I am using the let/get
property to set and retrieve this value. Should I perform the validation within
the let property or within a function that then calls the let, I ask this as a
let does not seem to be able to return a value.
Thanks in advance.
Rich