From RAD Studio API Documentation
Jump to: navigation, search


property MaxLength: Integer read FMaxLength write SetMaxLength default 0;


__property int MaxLength = {read=FMaxLength, write=SetMaxLength, default=0};


Type Visibility Source Unit Parent
property protected
Vcl.StdCtrls TCustomEdit


Specifies the maximum number of characters the user can enter into the edit control.

Use MaxLength to limit the number of characters that can be entered into the edit control. A value of 0 indicates that there is no application-defined limit on the length.

Use MaxLength to limit the length of the text in an edit control if that text will be copied into a fixed-length buffer.

Note: Setting MaxLength will not truncate the existing text, it merely prevents the user from adding more text after reaching the limit of MaxLength characters.

Note: Even when MaxLength is 0, there may be limitations imposed by the operating system on the number of characters that may be entered into an edit control.

Note: The unit of MaxLength is characters (not bytes) if the application is using themes.

See Also

Code Examples