Zum Laden und Speichern der Edits nutze ich folgende Prozedur:
Delphi-Quellcode:
procedure EditLaden (Filename: String);
const Sectionname = 'Texte';
var Ini: TIniFile;
i: integer;
begin
Ini := TIniFile.Create(Filename);
try
for i := 0 to Form1.ComponentCount - 1 do
if Form1.Components[i] is TEdit then
begin
TEdit(Form1.Components[i]).Text := Ini.ReadString(Sectionname,TEdit(Form1.Components[i]).Name,'Fehler');
end;
finally
Ini.Free;
end;
end;
procedure EditSpeichern (Filename: String);
const Sectionname = 'Texte';
var Ini: TIniFile;
i: integer;
begin
Ini := TIniFile.Create(Filename);
try
for i := 0 to Form1.ComponentCount - 1 do
if Form1.Components[i] is TEdit then
begin
Ini.WriteString(Sectionname,TEdit(Form1.Components[i]).Name,TEdit(Form1.Components[i]).Text);
end;
finally
Ini.Free;
end;
end;