procedure TForm1.Button1Click(Sender: TObject);var i:integer;begin for i:=1 to 2 do StringGrid1.Columns[i].Title.Caption:=IntToStr(i);end;
ColCount <> ColumnsAdd some Columns first
protected property TCustomGrid.ColCount: IntegerThis is the number of columns in the grid, including fixed and normal columns.
Why I need add columns, if these already in StringGrid?
procedure TForm1.Button1Click(Sender: TObject);var i:integer;begin for i := 1 to 2 do stringgrid1.cells [i,0] := inttostr (i);end;
Hi,If you want to write integer to the stringgrid try writing to the cells:...........
StringGrid1.ColumnByName('ColumnA').Rows[i]:='SampleText1';