RichEdit::GetLine

Description

Get the line of text at specified line index

Syntax

string GetLine( int nIndex = -1 )const

Parameters

nIndex
the zero-based index value for the desired character
in the text of the edit control, or contains -1. If nIndex is -1,
it specifies the current line, that is, the line that contains the caret.

Return

the text at given line or an empty string is line specified is not a valid line number

Examples

EX1

#include <..\OriginLab\DialogEx.h>
#define IDC_RICHEDIT1 1001

void RichEdit_GetLine(Dialog& EditBoxes)
{
        RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
        int ii, nLineLength;
        int nLineCount = richEdit.GetLineCount();
        string strText;
        for (ii = 0; ii < nLineCount; ii++)
        {
                nLineLength = richEdit.LineLength(ii);
                strText = richEdit.GetLine(ii);
        }
}

Remark

The implementation of this function is different from the MFC version. The MFC version is more difficult to use.

See Also

header to Include

Control.h