I'm very new to delphi, doing a project for my A level. When I run my code the images just don't show, I've looked everywhere and my teacher can't help me. Can anyone tell me what I'm missing?
const
Animal : array[0..6] of string = ('Bears','Dogs','Cats','Chickens','Horses','Cows','Monkeys');
ImagePaths : array [0..6] of string
= ('img0.JPG', 'img1.JPG', 'img2.JPG', 'img3.JPG', 'img4.JPG', 'img5.JPG',
'img6.JPG');
var i:integer;
Images : array [0..11] of TImage;
procedure LoadImages;
var
k,l:integer;
begin
Randomize;
k:=Random(11);
for l:= 0 to k do
begin
Images[l] := TImage.Create(nil);
Images[l].Picture.LoadFromFile(ImagePaths[i])
end
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
randomize;
i:=random(6);
QuestionLbl.Caption:=Format('How many %s are there?',[Animal[i]]);
LoadImages;
end;
The idea is that a random number of images of the same randomly selected animal is displayed for a child to then count and input, if that helps. Much appreciate any help.
edit.
as this is only a prototype I have copied it all to a new application and this is all the code I didn't include:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,jpeg, ExtCtrls;
type
TForm1 = class(TForm)
QuestionLbl: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
The same error is occurring and I'm afraid I'm too ignorant to follow what I'm sure were very clear instructions.