Freigeben über


CEdit::GetLineCount

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

int GetLineCount( ) 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

GetLineCount is only processed by multiple-line edit controls.

For more information, see EM_GETLINECOUNT in the Windows SDK.

Example

int i, nLineCount = m_myEdit.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 = m_myEdit.LineLength(m_myEdit.LineIndex(i));
   m_myEdit.GetLine(i, strText.GetBuffer(len), len);
   strText.ReleaseBuffer(len);
   strLine.Format(_T("line %d: '%s'\n"), i, strText);
   AFXDUMP(strLine);
}

Requirements

Header: afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

Other Resources

CEdit Members