Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.ButtonSaveClick(Sender: TObject);
- var
- I: Integer;
- Strings: TStringList;
- begin
- Strings := TStringList.Create;
- try
- for I := 0 to ComponentCount - 1 do
- if Components[I] is TLabel then
- Strings.Values[Components[I].Name] := TLabel(Components[I]).Caption;
- Strings.SaveToFile('C:\File.ext');
- finally
- Strings.Free;
- end;
- end;
- procedure TForm1.ButtonLoadClick(Sender: TObject);
- var
- I: Integer;
- Control: TComponent;
- Strings: TStringList;
- begin
- Strings := TStringList.Create;
- try
- Strings.LoadFromFile('C:\File.ext');
- for I := 0 to Strings.Count - 1 do
- begin
- Control := FindComponent(Strings.Names[I]);
- if Control is TLabel then
- TLabel(Control).Caption := Strings.ValueFromIndex[I];
- end;
- finally
- Strings.Free;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement