Ir para conteúdo
Fórum Script Brasil
  • 0

Txt


Vivendo&Aprendendo

Pergunta

3 respostass a esta questão

Posts Recomendados

  • 0

coloque 5 Edits e quatro button (btnFirst, btnPrior, btnNext, btnLast) e use esse codigo abaixo.

unit Unit1;

interface

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  Menus, StdCtrls;

type

  TForm1 = class(TForm)

    Button1: TButton;

    Edit1: TEdit;

    Edit2: TEdit;

    Edit3: TEdit;

    Edit4: TEdit;

    Edit5: TEdit;

    btnFirst: TButton;

    btnPrior: TButton;

    btnNext: TButton;

    btnLast: TButton;

    procedure FormShow(Sender: TObject);

    procedure btnFirstClick(Sender: TObject);

    procedure btnPriorClick(Sender: TObject);

    procedure btnNextClick(Sender: TObject);

    procedure btnLastClick(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form1: TForm1;

  Campo1 : array[1..1000] of String;

  Campo2 : array[1..1000] of String;

  Campo3 : array[1..1000] of String;

  Campo4 : array[1..1000] of String;

  Campo5 : array[1..1000] of String;

  f : TextFile;

  linha : String;

  i, max : Integer;

implementation

{$R *.DFM}

procedure TForm1.FormShow(Sender: TObject);

begin

  AssignFile(f,'C:\CLIENTES.txt');

  Reset(f);

  i := 0;

  while not eof(f) do begin

    i := i + 1;

    Readln(f,linha);

    Campo1 := Copy(linha,1,pos(';',linha)-1);

    Delete(linha,1,Pos(';',linha));

    Campo2 := Copy(linha,1,pos(';',linha)-1);

    Delete(linha,1,Pos(';',linha));

    Campo3 := Copy(linha,1,pos(';',linha)-1);

    Delete(linha,1,Pos(';',linha));

    Campo4 := Copy(linha,1,pos(';',linha)-1);

    Delete(linha,1,Pos(';',linha));

    Campo5 := linha;

  end;

  Closefile(f);

  max := i;

  i := 1;

  Edit1.Text := campo1[1];

  Edit2.Text := campo2[1];

  Edit3.Text := campo3[1];

  Edit4.Text := campo4[1];

  Edit5.Text := campo5[1];

  BtnFirst.Enabled := False;

  BtnPrior.Enabled := False;

  BtnNext.Enabled := True;

  BtnLast.Enabled := True;

end;

procedure TForm1.btnFirstClick(Sender: TObject);

begin

  i := 1;

  Edit1.Text := campo1[1];

  Edit2.Text := campo2[1];

  Edit3.Text := campo3[1];

  Edit4.Text := campo4[1];

  Edit5.Text := campo5[1];

  BtnFirst.Enabled := False;

  BtnPrior.Enabled := False;

  BtnNext.Enabled := True;

  BtnLast.Enabled := True;

end;

procedure TForm1.btnPriorClick(Sender: TObject);

begin

  i := i-1;

  if i >= 1 then begin

    Edit1.Text := campo1;

    Edit2.Text := campo2;

    Edit3.Text := campo3;

    Edit4.Text := campo4;

    Edit5.Text := campo5[1];

    BtnNext.Enabled := True;

    BtnLast.Enabled := True;

  end else begin

    i := 1;

    BtnFirst.Enabled := False;

    BtnPrior.Enabled := False;

    BtnNext.Enabled := True;

    BtnLast.Enabled := True;

  end;

end;

procedure TForm1.btnNextClick(Sender: TObject);

begin

  if i < max then begin

    i := i+1;

    Edit1.Text := campo1;

    Edit2.Text := campo2;

    Edit3.Text := campo3;

    Edit4.Text := campo4;

    Edit5.Text := campo5[1];

    BtnFirst.Enabled := True;

    BtnPrior.Enabled := True;

  end else begin

    i := max;

    Edit1.Text := campo1;

    Edit2.Text := campo2;

    Edit3.Text := campo3;

    Edit4.Text := campo4;

    Edit5.Text := campo5[1];

    BtnFirst.Enabled := True;

    BtnPrior.Enabled := True;

    BtnNext.Enabled := False;

    BtnLast.Enabled := False;

  end;

end;

procedure TForm1.btnLastClick(Sender: TObject);

begin

  i := max;

  Edit1.Text := campo1;

  Edit2.Text := campo2;

  Edit3.Text := campo3;

  Edit4.Text := campo4;

  Edit5.Text := campo5[1];

  BtnFirst.Enabled := True;

  BtnPrior.Enabled := True;

  BtnNext.Enabled := False;

  BtnLast.Enabled := False;

end;

end.

Abs. Progr'amador.

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...