Pass object/component to procedure lazarus / 61-Beginners ---------------------------------------------------------------------- Researching · 2023-05-17 17:44 Need to pass object to procedure or method and get it processed by certain operations. Module_1: uses Module_2 Procedure SendRecordsToTable(                           ListOfRecords:array of Records;                           Table:TStringGrid ); begin    for i=0 to sizeOf (ListOfRecords)-1 do        for j=0 to sizeOf(ListOfRecords[j]-1) do begin                 vRow:= i+1;                 vCol := j+1;                 StringToStringGrid                         (StringGrid, vCol,vRow, ListOfRecords[j]-1 ) Module_2: procedure StringToStringGrid (StringGrid, vCol, vRow, string) // this will write the string to StrGrid cells. Actually need to put records from array or list to StringGrid But different stringGrid in different Cases. Actually StringGrid will be located on different Pages of Page Control. TForm1.PageControl1 ... Array of Records -> procedure -> StringGrid. And StringGrid is StrGr1 StrGr2 StrGr3 etc. ---------------------------------------------------------------------- cdbc · 2023-05-17 18:52 Hi Something like this: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 function bcGridSetRowText(aGrid: TStringGrid;aRow: ptrint;RowCells: array of string): ptrint;var  I,Cnt: ptrint;  function min(a,b: ptrint): ptrint; begin if a <= b then Result:= a else Result:= b; end;begin  Cnt:= min(aGrid.ColCount,Length(RowCells));  if Cnt = 0 then exit(-1);  if aRow = -1 then begin { add a row }    aRow:= aGrid.RowCount;    aGrid.RowCount:= aGrid.RowCount + 1;  end;  if aRow < aGrid.RowCount then for I:= 0 to Cnt -1 do     Grid.Cells[I,aRow]:= RowCells[I];  Result:= aRow;end; Hth Regards Benny ---------------------------------------------------------------------- Researching · 2023-05-18 04:16 Not yet clear how it works... Input data: object/component: Form1.StringGrid1 Record to fill in entity = Record     PKey:integer; //will require IntToStr(entity.PKey)     Name : string;     address:string    end; Result: new row in StringGrid. And the main question is still: The syntax of how to pass and receive parameters: from the calling procedure_A (iterating the array of records) in the call of procedure_B and receive in the called procedure_B (filling data in StringGrid) for example: var TRecordMy = Record     PKey:integer; //will require IntToStr(entity.PKey)     Name : string;     address:string    end; ............................. proc_A (); begin proc_B(form1.StringGrid1, myArray[n]) end; Proc_B(aGrid: TStringGrid; aRecord: TRecordMy) ---------------------------------------------------------------------- TRon · 2023-05-18 04:50 To keep it in the spirit of cdbc's answer: 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 type TMyArray = array of TRecordMy; procedure proc(SG: TStringGrid; Items: TMyArray);var  Item     : TRecordMy;  rowindex : integer;  RowCells : Array of string;begin  Rowindex := 1;  for item in items do  begin    RowCells := [Item.PKey.ToString, Item.Name, Item.address];    bcGridSetRowText(SG, Rowindex, RowCells);    inc(rowindex);  end;end;