Solved

TMemo Limit

Posted on 1997-03-16
1
317 Views
Last Modified: 2010-04-04
I want to limit a TMemo window to 100 lines.
If a 101st line is added, delete the 1st Line
so that always only the last 100 Lines are there.
Please e-mail me with response
Lechtor@kalamazoo.net
0
Comment
Question by:lechtor
1 Comment
 
LVL 3

Accepted Solution

by:
mheacock earned 50 total points
Comment Utility
Is the text coming from user input or from a file?

Use a combination of the following TMemo methods and
properties to achieve what you want:

    create a variable that will keep track of the number of lines.
    use the OnKeyPress event to capture the use of the ENTER key, increment the NumLines variable each time.
    check NumLines after each ENTER keypress, if it is >100,
use the DELETE method to delete the first line in the TMemo, decrement the NumLines by one.

If you are reading from a file, it is trivial to keep track of the number of lines entered into the TMemo yourself.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now