March 4th, 2012, 01:55 AM
Load Text From File in Delphi
i m a beginner in delphi,,
now i m so confused about load text from file,,
before, i made a program in delphi which save text in a file
Ex : delphi 123456
i want when i click load button, delphi in Edit1 and 123456 in Edit2
plz help me
NB : sorry for my bad language
March 4th, 2012, 07:31 PM
It is hard to know from your post how complex your situation or how large the text files
If the text files will fit comfortably in memory and you only want to break the file into
strings based upon carriage returns (as implied by readln) then you could just load the
file into a stringList.
Ofcourse, you may want the TStringList to be more permanent and be available for
myStrings := TStringList.Create;
// Do what you want here
// e.g. Edit1.Text := myStrings;
interaction with the user. In such a case you might want it to be created in FormCreate.
The example I gave is just to illustrate loading the file and accessing the first line.