Delphi tips :

Line number of the cursor in a TMemo

To determine which line number the cursor of a Memo component is in, you can use the Windows API function SendMessage.
(API = Application Programmr Interface)

In the example below, the integer variable LineNumber receives the line number that the cursor of Memo1 is in:

LineNumber := 
  SendMessage(Memo1.Handle, EM_LINEFROMCHAR, Memo1.Selstart, 0);

TOP   DelphiLand Club Membership  DC Library  Forum  Forum Archives  Crash Course Delphi  Tips  Source Code  Downloads  Links