New application, add two TLABEL components named Label1, label2 on the form form1;
Add two TBUTTON components named button1, button2; add a TMEMO component named MEMO1.
Then add the following code in the code editor.
Void __fastcall tform1 :: button1click (Tobject * Sender)
{
Label1 → CAPTION = SendMessage (Memo1 → Handle, EM_LINEFROMCHAR, -1, 0) 1;
}
Void __fastcall tform1 :: button2click (Tobject * Sender)
{
Label2 → CAPTION = MEMO1 → SELSTART-SendMessage (Memo1 → Handle, EM_LINEINDEX, -1, 0) 1;
}
This method is equally applicable to Richedit.