unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
List: TStrings;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
List := TStringList.Create;
try
List.LoadFromFile('C:\Daten.txt');
if List.Count>0 then
Edit1.Text:=List[0];
finally
List.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
List := TStringList.Create;
try
List.Add(Edit1.Text);
List.SaveToFile('C:\Daten.txt');
finally
List.Free;
end;
begin
StringVariable := IntToStr(StrToIntDef(StringVariable, 0) + 1);
end;
end;
end.