>>In VFP 5, I am trying to take advantage of the MaxLength property in a textbox subclass. I have tried the following code:
>>This.MaxLength = ;
>> iif(!empty[This.ControlSource], fsize[This.ControlSource], 0)
>>Anyone have any luck with this?
>>
>>TIA.
>
>Mark,
>
>MaxLength will do exactly what you are asking.
>
>Where did you put that code? I would place it in the Init of the control. Actually I would put it in a custom method named something like SetMaxLength and call that from the Init. Thatw ay if I ever changed the ControlSource at runtime I just have to call the SetMaxLength method.
That is what I am doing, but when I try it, the length seems to be font-specific (I am using Aerial). For example, for a 40 character field, it does not terminate until about character 46.
Mark McCasland
Midlothian, TX USA