-----x-----
douglas vieira escreveu:

(...)
  procedure TForm1.Button1Click ( Sender : TObject );
   var
     existe : String;
     Arq, Arquivo : TStringList;
     Linha, LinhaGrava : String;
     x, cont : integer;
   begin
   
     if edtmatricula.text = '' then
       begin
         showmessage( 'Digite a Matricula do Agente' );
         edtmatricula.setfocus;
       end
       else
         if edtnome.text = '' then
           begin
             showmessage( 'Digite o Nome do Agente' );
             edtnome.setfocus;
           end
           else
             if edtaparelho.text = '' then
               begin
                 showmessage( ' Digite o Código do Aparelho' );
                 edtaparelho.setfocus;
               end
               else
                 begin
                    existe := ( 'c:\' + ( formatdatetime( 'dd-mm-yy', now ) + 
'.txt'));
                   Arq := TStringList.Create;
                   Arquivo := TStringList.Create;
                   Linha := '';
                   LinhaGrava := '';
                   cont := 0;
                      if  not FileExists( existe ) then
                       begin
                          FileCreate( existe );
                          //LinhaGrava := ( edtmatricula.text + ',' + 
edtaparelho.text + ',' +  edttelefone.text + ',' + edtnome.text );
                          //Arquivo.Add( LinhaGrava );
                          //Arquivo.SaveToFile( existe );
                          //limpacampos( form1 );
                       end
                       else
                          //if FileExists( existe ) then
                            begin
                            Arq.LoadFromFile( existe );
                            For x := 0 to Arq.Count - 1 do
                              begin
                                Arquivo.Add(Arq.Strings[x]);
                                inc(cont);
                              end;
                              LinhaGrava := ( edtmatricula.text + ',' + 
edtaparelho.text + ',' +  edttelefone.text + ',' + edtnome.text );
                              Arquivo.Add( LinhaGrava );
                              Arquivo.SaveToFile( existe );
                              limpacampos( form1 );
   
                          end;
                 end;
   end;
(...)
-----x-----

[Welson] Nessa rotina acima, tente usar "existe : TextFile;"
Eu fiz um programinha exemplo desse tipo há um tempinho. Se quiser, eu te 
mando. Pra qual email seu que eu mando ?!

Abraços...



=================================
"Nunca ande pelo caminho traçado, pois ele conduz somente até onde os outros já 
foram."
Alexander Graham Bell
=================================
Welson de Avelar Soares Filho
Programador Delphi
Gemini Sistemas
<www.geminisistemas.com.br>
Juiz de Fora - Minas Gerais
=================================
                
---------------------------------
 Yahoo! doce lar. Faça do Yahoo! sua homepage.

[As partes desta mensagem que não continham texto foram removidas]



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

<*> Para ver as mensagens antigas, acesse:
    http://br.groups.yahoo.com/group/delphi-br/messages

<*> Para falar com o moderador, envie um e-mail para:
    [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a