VCL Delphi

With Memo1 do
SelStart := Perform(EM_LINEINDEX, Line, 0);