Coponents and names(Solved) lazarus / 61-Beginners ---------------------------------------------------------------------- JLWest · 2022-03-20 06:24 I have 52 card images labeled I1...I52; I can always find the string value 'I1'..'I52'. But I would like the Timage name I1..I52. My code at line 8 isn't right. I need to pass it as a parm in the procedure ShowTrash. Thanks Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.MoveToTrash(S : integer); Var  ImageName : TImage;  MyImageName : string; begin  Inc(GTRASHBIN);  MyImageName:='I'+IntToStr(S);  ImageName := TImage.FindComponent(MyImageName);   // Error  ShowTrash( GTRASHBIN,ImageName ); end; ---------------------------------------------------------------------- Josh · 2022-03-20 07:46 ImageName := TImage(FindComponent(MyImageName)); ---------------------------------------------------------------------- JLWest · 2022-03-20 07:57 Perfect! Thanks ---------------------------------------------------------------------- Josh · 2022-03-20 09:33 Your welcome Question/Test for JLWest Can you explain why it works; and why your code did not? I Know this is odd thing to post; but I think a good learning question; rather than just fixing code.. ---------------------------------------------------------------------- JLWest · 2022-03-20 17:12 ImageName := TImage.FindComponent(MyImageName); ImageName := TImage(FindComponent(MyImageName)); I can see the difference but don't understand. ---------------------------------------------------------------------- PascalDragon · 2022-03-21 10:06 Quote from: JLWest on March 20, 2022, 06:12:03 pmImageName := TImage.FindComponent(MyImageName); You try to execute the method FindComponent on the class type TImage. TImage however does not have a class method named FindComponent, only an instance method. Quote from: JLWest on March 20, 2022, 06:12:03 pmImageName := TImage(FindComponent(MyImageName)); This executes FindComponent of the current class (your form) and casts the found result to a TImage.