Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

MaxLength

This property determines the maximum number of characters that can be entered in an edit box or text box.

Usage

oObject.MaxLength = nMaxChars
nMaxChars = oObject.MaxLength

To let the user enter an unlimited number of characters, set MaxLength to 0. When MaxLength is non-zero, additional characters are thrown away. Be careful when you bind controls to fields. If MaxLength is less than the field length (or the current length of a memo field), if you change the data at all, the characters beyond MaxLength may be discarded.

In VFP 3, this property applied only to edit boxes. It was added to text boxes in VFP 5.

Example

This.MaxLength = 400

See Also

EditBox, TextBox