The document is archived and information here might be outdated


Call this function to retrieve the number of lines in a multiple-line edit control.

int GetLineCount( ) const;

An integer containing the number of lines in the multiple-line edit control. If no text has been entered into the edit control, the return value is 1.

GetLineCount is only processed by multiple-line edit controls.

For more information, see EM_GETLINECOUNT in the Platform SDK.

#ifdef _DEBUG
   extern CEdit* pmyEdit;    // The pointer to my edit control:

   int i, nLineCount = pmyEdit->GetLineCount();
   CString strText, strLine;
   // Dump every line of text of the edit control.
   for (i=0;i < nLineCount;i++)
      // length of line i:
      int len = pmyEdit->LineLength(pmyEdit->LineIndex(i));
      pmyEdit->GetLine(i, strText.GetBuffer(len), len);
      strLine.Format(TEXT("line %d: '%s'\n"), i, strText);
      afxDump << strLine;
© 2016 Microsoft