Ver Mensaje Individual
  #7  
Antiguo 14-11-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
O con el mismo resultado y más simple:
Código Delphi [-]
implementation

const
   RTA_ARCH = 'C:\DBA\contar.txt';
var
  ContadorDeEnter: Integer;
  TS: TStrings;

procedure TForm1.FormCreate(Sender: TObject);
var
  s: string;
begin
  KeyPreview:= True;
  TS:= TStringList.Create;
  TS.LoadFromFile(RTA_ARCH);
  ContadorDeEnter:= StrToInt(TS[TS.Count-1]);
  StaticText1.AutoSize:= False;
  StaticText1.Caption:= TS[TS.Count-1];
  StaticText1.BevelKind:= bkTile;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    Inc(ContadorDeEnter);
    StaticText1.Caption:= IntToStr(ContadorDeEnter);
    TS.Add(StaticText1.Caption);
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  TS.SaveToFile(RTA_ARCH);
  TS.Free
end;

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 15-11-2012 a las 02:01:51.
Responder Con Cita