Unit Unit1;
Interface
Uses Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls;
Type TForm1 =
Class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button2: TButton;
Procedure FormCreate(Sender: TObject);
Procedure FormDestroy(Sender: TObject);
Procedure Button1Click(Sender: TObject);
Procedure Button2Click(Sender: TObject);
End;
Var Form1: TForm1;
List: TStringList;
Implementation
{$R *.dfm}
Procedure TForm1.TForm1.FormCreate(Sender: TObject);
Begin
List := TStringList.Create;
End;
Procedure TForm1.FormDestroy(Sender: TObject);
Begin
List.Free;
End;
Procedure TForm1.Button1Click(Sender: TObject);
Var a: Integer;
Begin
List.Clear;
For a := 1
to 3
do
List.Add((FindComponent('
edit' + IntToStr(a))
as TEdit).Text);
List.SaveToFile ('
test');
End;
Procedure TForm1.Button2Click(Sender: TObject);
Var a: Integer;
Begin
List.LoadFromFile('
test');
For a := 1
to 3
do
(FindComponent('
edit' + IntToStr(a))
as TEdit).Text := List.Strings[a - 1];
End;
End.