Share via


CEdit::GetLineCount

intGetLineCount()const;

Return Value

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.

Remarks

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

GetLineCount is only processed by multiple-line edit controls.

For more information, see in the Win32 documentation.

Example

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

   int i, nLineCount = pmyEdit->GetLineCount();
   CString strText, strLine;

   // Dump every line of text of the edit control.
   for (i=0;i < nLineCount;i++)
   {
      pmyEdit->GetLine(i, strText.GetBuffer(pmyEdit->LineLength(i)));
      strText.ReleaseBuffer();

      strLine.Format(TEXT("line %d: '%s'\r\n"), i, strText.GetBuffer(0));
      afxDump << strLine;
   }
#endif

CEdit OverviewClass MembersHierarchy Chart