We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

CEdit::GetLimitText

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

UINT GetLimitText( ) const;

The current text limit, in bytes, for this CEdit object.

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

NoteNote:

This member function is available beginning with Windows 95 and Windows NT 4.0.

For more information, see EM_GETLIMITTEXT in the Windows SDK.

CString strText(_T("I'm an edit control!"));
UINT nLength = strText.GetLength() * sizeof(TCHAR);

// Want the text limit to be at least the size of the new string. 
if (m_myEdit.GetLimitText() < nLength)
   m_myEdit.SetLimitText(nLength);

m_myEdit.SetWindowText(strText);

Header: afxwin.h

Show: