Answer the question
In order to leave comments, you need to log in
How to generate a list from a text file in Delphi?
One of the noobs (me) has a list (ListBox) and a text file (children.txt), and when opening a window in the list should be formed from this file.
For example:
text file:
Pupkin Vasily
Fruktozyan Banani
list:
Pupkin Vasily
Fruktozyan Banani
, etc.
Answer the question
In order to leave comments, you need to log in
Global FName of type string;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.LoadFromFile(FName);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
with OpenDialog1 do
if Execute(Handle) then
begin
FName:= FileName;
end;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question