StringGridColCount (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

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.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  int I, J, K;

  K = 0;

  for (I = 0; I < StringGrid1->ColCount; I++)
    for (J = 0; J < StringGrid1->RowCount; J++)
      StringGrid1->Cells[I][J] = IntToStr(++K);
}

Uses