I am having some issues with a piece of code I wrote. I am using a TStringGrid to draw a seating plan.
What it is supposed to do is label the fixedcol and fixedrow with the letter down the column and numbers for the rows.
My problem is i don't know how to change my code so that it excludes the cell [0,0]. It is also not labeling all the rows.
procedure TfrmDraw.FormCreate(Sender: TObject);
var
i, j, k: Integer;
begin
sgFloor.RowCount := adotSeats['Rows'] + 1;
sgFloor.ColCount := adotSeats['Seats_per_Row'] + 1;
for i := 0 to SgFloor.RowCount do
begin
for j := 0 to SgFloor.ColCount do
begin
if i = 0 then
SgFloor.Cells[i,j] := Chr(65 + j)
else
if j = 0 then
begin
for k := 1 to sgFloor.ColCount do
SgFloor.Cells[i,0] := IntToStr(i) ;
end;
end;
end;
end;
Screenshot:
Thanks