I'm new to class modules, and the compiler seems to be enforcing a correlation of the number of input vars for a Get and Let procedure of the same property. The Let property must always have exactly one more variable (the NewValue) than the Get procedure. So the code I've got below does not work, because of the discrepancy in input vars:
Property Get Length() As Integer
Length = UBound(mProj, 2)
End Property
Property Let Length(NewVal As Integer, Clear As Boolean)
If NewVal < 0 Then Err.Raise 50000, , "Value cannot be negative."
If Clear = True Then
ReDim mProj(1, NewVal)
Else
ReDim Preserve mProj(1, NewVal)
End If
End Function
(i altered a bit for clarity so there might be a minor mistake)
My question is why does this have to be the case? It seems that a person, when setting a property to a certain value, might have an untold number of factors affecting the decision, which should be passed as variables. But to simply retrieve this certain property might require no input variables at all.
It just seems like such a strange issue to a fundamental situation, so I was wondering if anyone knows of a workaround, or if I'm missing something, etc.