Write an OnChange event handler to take specific action whenever the text for the syntax memo may have changed. Use the Modified property to see if a change actually occurred. The Lines property of the memo will already be updated to reflect any changes.