RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDrawGrid.RowCount Property

Specifies the number of rows in the grid.

Pascal
property RowCount: Longint;
C++
__property Longint RowCount;

Read RowCount to determine the number entries in the RowHeights array. Set RowCount to add or delete rows at the bottom of the grid. The value of RowCount includes any fixed rows at the top of the grid as well as the scrollable rows in the body of the grid.  

Delphi Examples: 

 

{
This code fills each cell with a number. The numbers are
arranged in consecutive order by rows.  Notice that even
cells in the fixed rows and columns are altered.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  I, J, K : Integer;
begin
  K := 0;
  with StringGrid1 do
    for I := 0 to ColCount - 1 do
      for J:= 0 to RowCount - 1 do
        begin
          K := K + 1;
          Cells[I,J] := IntToStr(K);
        end;
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!