Compartir a través de


CEdit::SetLimitText

Call this member function to set the text limit for this CEdit object.

void SetLimitText(
   UINT nMax 
);

Parameters

  • nMax
    The new text limit, in characters.

Remarks

The text limit is the maximum amount of text, in characters, that the edit control can accept.

Changing the text limit restricts only the text the user can enter. It has no effect on any text already in the edit control, nor does it affect the length of the text copied to the edit control by the SetWindowText member function in CWnd. If an application uses the SetWindowText function to place more text into an edit control than is specified in the call to LimitText, the user can delete any of the text within the edit control. However, the text limit will prevent the user from replacing the existing text with new text, unless deleting the current selection causes the text to fall below the text limit.

This function replaces LimitText in Win32.

For more information, see EM_SETLIMITTEXT in the Windows SDK.

Example

See the example for CEditView::GetEditCtrl.

Requirements

Header: afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

CEdit::GetLimitText

CEdit::LimitText

Other Resources

CEdit Members