-2

The jpeg is in the uses section.

Procedure TFrmChemistry.AddBasicGroups;
var i,side: integer;
begin
Side := 0;
for i := 1 to 3 do
begin
Images[i].Diagram := TImage.Create(gbxParts);
Images[i].Diagram.Parent := TTabBasicGroups;
Images[i].Diagram.Visible :=true;
Images[i].Diagram.Picture.LoadFromFile(Images[i].Chemical); // unknown file extension.jpg
Images[i].Diagram.AutoSize := true;
Images[i].Diagram.Tag := i;
Images[i].Diagram.Top := ((Chempage.Height)Div 2) - ((Images[i].Diagram.Height) Div 2);
Images[i].Diagram.Left := 10 + side;
Images[i].Diagram.OnClick := ImageCreate;
Side := Side + Images[i].Diagram.Width;

end;
end;

Images is an array of records, Diagram is a TImage, Chemical is a string of the file name. It was working originally when I was defining the string in code, but after I started defining it from a database it stopped working.

Thanks in advance.

TheBlueCat
  • 1,147
  • 5
  • 19
  • 38

1 Answers1

2

Given the fact that it works fine when you hard-coded the filename, but does not work when retrieving the filename from a database, I have to assume that the value from the database is malformed, such as if it has extra space/null characters at the end. Without actually seeing the filename in question, or the full error message, this is only an educated guess.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770