Given an array, with data about cars (StringGrid1), I need to enter the name of the car in Edit, if there is one, output the full string in StringGrid2.
procedure TForm1.Button1Click(Sender: TObject); var a,b:array of TCar; f:boolean; i,j,n,m:integer; begin n:=spinedit1.value; setlength(a,n); for i := 0 to n-1 do begin a[i+1].carbrand:=stringgrid1.cells[1,i+1]; a[i+1].registr:=stringgrid1.cells[2,i+1]; a[i+1].lastname:=stringgrid1.cells[3,i+1]; a[i+1].date:=stringgrid1.cells[4,i+1]; end; m:=0; f:=false; repeat if (edit1.Text=stringgrid1.cells[1,m]) then f:=true else m:=m+1; until ((m>n) or f); { if f then showmessage('+') else showmessage('-'); } for i := 0 to m-1 do setlength(b,m); begin stringgrid2.Cells[1,i+1]:=b[i].carbrand; stringgrid2.Cells[2,i+1]:=b[i].registr; stringgrid2.Cells[3,i+1]:=b[i].lastname; stringgrid2.Cells[4,i+1]:=b[i].date; end; end; Please tell me what the error is, does not display the appropriate strings in a StringGrid2?