Click here to Skip to main content
13,088,846 members (54,367 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How Can I Add Data(String type or integer and ...) To 'TStringList' From a 'TextFile'and then Count the same Data(this=5, or=3 ,123=12 for example) at last show into the 'ListBox' or 'TextBox' something like that,Please help me anyone who knows Delphi well.
Posted 5-Feb-13 19:36pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

To add data, you'll do something like:
SLst := TStringList.Create;
//To add string to a TStringList:
SLst.Add('This is a string');
//To add integer

you'll define SLst by:
  SLst: TStringList;

And if you want to load it from a textfile:

And what do you mean by count the same data? You mean to count how much lines there are in the File? If yes, then:
Count := SLst.Count;

But if you want to show the data in a Memo, then do the following instead of all the above code:
Count := Memo1.Lines.Count;

I hope my answer helped.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 20 Dec 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100