unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  count: integer;
begin
  for count := 1 to 10 do
  begin
    Image1.Picture.LoadFromFile('T'+ IntToStr(count)+'.bmp');
    sleep(100);
    update;
  end;
end;

end.

Hi,

Thank you for your kind reply and help. But could you mind tell me why I cannot put 'for count := 1 to 10 do' to the program?

Cheers,

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
var
  count: integer;
begin
  for count := 1 to 10 do
  begin
    Image1.Picture.LoadFromFile('T'+ IntToStr(count)+'.bmp');
    sleep(100);
    update;
  end;
end;

end.
This article has been dead for over six months. Start a new discussion instead.