How to control the scroll buffer of a TMemo #102

Question
I would like the TMemo object to have a 250 line scroll buffer. In other words, when the 251st line is added, the first line is removed from the TMemo object. Is there a way to accomplish this without having to copy each string from index n to index n - 1 each time the 250th line is added?

You can use TStrings' Delete method and pass the index to it.

if memo1.Lines.Count = 251 then
  Memo1.lines.Delete(0);
Original resource: The Delphi Pool
Author: Eddie Shipman
Added: 2009/09/14
Last updated: 2009/09/14