I am trying to replace stringgrid1 and stringgrid2 with listbox1 and listbox2 respectively. Is there any way I can do this? If listbox can't do it, can anyone suggest what should I use instead of stringgrid to display information? I am new to Delphi.
This is my code:
procedure TForm2.FormCreate(Sender: TObject); var i:integer; begin stringgrid1.ColWidths[0]:=20; stringgrid2.ColWidths[0]:=20; for i:=1 to 50 do begin stringgrid1.Cells[0,i]:=inttostr(i-1); stringgrid2.Cells[0,i]:=inttostr(i-1); stringgrid2.Cells[1,i]:='0'; end; stringgrid2.Cells[1,0]:='name'; stringgrid1.Cells[1,0]:='extension'; stringgrid1.Cells[2,0]:='format'; stringgrid1.Cells[3,0]:='size'; stringgrid1.Cells[4,0]:='date'; stringgrid1.Cells[5,0]:='addres'; end; procedure TForm2.StringGrid2DblClick(Sender: TObject); begin if (stringgrid2.Cells[1,stringgrid2.Row]<>'1024') and (stringgrid2.Cells[1,stringgrid2.Row]<>'0') then stringgrid1.Row:=strtoint(stringgrid2.Cells[1,stringgrid2.Row]); end;
end.
Procedure HD; var i:integer; begin for i:=0 to 50 do begin form2.StringGrid1.Cells[1,i+1]:=TABLE[i].name; form2.StringGrid1.Cells[2,i+1]:=TABLE[i].format; if TABLE[i].tip then form2.StringGrid1.Cells[3,i+1]:='folder' else form2.StringGrid1.Cells[3,i+1]:='file'; form2.StringGrid1.Cells[4,i+1]:=inttostr(TABLE[i].nach); form2.StringGrid1.Cells[5,i+1]:=inttostr(TABLE[i].razmer); form2.StringGrid2.Cells[1,i+1]:=inttostr(fat[i]);; end; end;
source share