TStringGrid Title.Caption lazarus / 31-LCL ---------------------------------------------------------------------- totya · 2011-01-22 10:52 Hi! I put TStringGrid to the new form. Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin   for i:=1 to 2 do StringGrid1.Columns[i].Title.Caption:=IntToStr(i); end; This code cause error: "EListError, list index(1) out of bounds. But why? Default Colcount is 5. My version is: Lazarus-0.9.31-29128-fpc-2.4.3-20110120-win32.exe Thanks! ---------------------------------------------------------------------- theo · 2011-01-22 10:56 ColCount <> Columns Add some Columns first ---------------------------------------------------------------------- totya · 2011-01-22 11:02 Quote from: theo on January 22, 2011, 11:56:16 amColCount <> Columns Add some Columns first Hi thanks, but Help wrote: Quoteprotected property TCustomGrid.ColCount: Integer This is the number of columns in the grid, including fixed and normal columns. Why I need add columns, if these already in StringGrid? ---------------------------------------------------------------------- theo · 2011-01-22 11:42 Quote from: totya on January 22, 2011, 12:02:13 pmWhy I need add columns, if these already in StringGrid? They don't have the same meaning. ColCount column-properties are not accessible individually, as your error says. It's not ideal. See also: http://bugs.freepascal.org/view.php?id=12823 ---------------------------------------------------------------------- Scoops · 2011-01-22 12:50 Hi, If you want to write integer to the stringgrid try writing to the cells: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin   for i := 1 to 2 do stringgrid1.cells [i,0] := inttostr (i); end; hope it helps ---------------------------------------------------------------------- totya · 2011-01-22 13:09 Quote from: Scoops on January 22, 2011, 01:50:56 pmHi,If you want to write integer to the stringgrid try writing to the cells:........... Hi, thx, but I know this And, this is can't works, if uses Columns. Columns need of PickList, etc... ---------------------------------------------------------------------- asdf · 2011-02-02 06:48 // try this first and compile procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin   for i:=1 to 1 do   // try this first and change to  i:=1 to 2...., you'll understand the wonder of grid.   begin   StringGrid1.Columns.Add; // Add 1 column   StringGrid1.Columns[i-1].Title.Caption:=IntToStr(i);   end; end; ---------------------------------------------------------------------- mdalacu · 2014-01-10 13:45 Hi, can i reference a column by it's title name? like filedbyname? Ex: Code: [Select]StringGrid1.ColumnByName('ColumnA').Rows[i]:='SampleText1';Is it posibble? Thank you.