Assignation de TStringGrids
Bonjour,
je me demande si ce code d'assignation est correct. J'avoue utiliser de moins en moins le Pascal Object.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| procedure TForm1.sgFillMonth(aYear, aMonth: integer);
var
aRow: integer;
aSG: TStringGrid;
begin
aSG := TStringGrid.Create(nil);
case aMonth of
1: aSG :=SG01;
2: aSG :=SG02;
end;
with aSG do
begin
RowCount := DaysInAMonth(nYearCurrent, aMonth) + 1;
for aRow := 1 to RowCount - 1 do
begin
Cells[2, arow] := IntToStr(arow);
end;
end;
aSG:= Nil;
asG.Free;
end; |
avec
Code:
1 2 3 4 5 6 7 8 9 10
| type
TForm1 = class(TForm)
cbYEAR: TComboBox;
SG01: TStringGrid;
SG02: TStringGrid;
private
procedure sgFillMonth(aYear, aMonth : Integer);
public
end; |
Merci. Cordialement. Gilles