Getting the number of columns and their widths from a DBGrid. lazarus / 16-Databases ---------------------------------------------------------------------- Hopestation · 2010-12-03 12:19 I have used a DBGrid in Delphi4 and the following code gets the number of columns and their widths. procedure TForm1.FormCreate(Sender: TObject); var   M, N: Integer; begin   Show;   M := DBGrid1.FieldCount - 1;   DBGrid1.Width := 40;   For N := 0 to M Do   begin     DBGrid1.Width := DBGrid1.width + DBGrid1.columns[N].width;     Application.ProcessMessages;   end;   ClientWidth := DBGrid1.Left + DBGrid1.Width; end; I tried copying it straight into Lazarus and it was rejected because FieldCount was not a valid property. I looked up TDBGrid in Lazarus Help, using F1, and FieldCount is not listed as a property. Will DBGrid1.columns[N].width also be rejected? How do I do the above in Lazarus? Thanks in advance. Roger King ---------------------------------------------------------------------- cpalx · 2010-12-03 12:47 did you try DBGrid.Columns.Count ---------------------------------------------------------------------- Hopestation · 2010-12-03 15:06 Thanks Cpalx. Yes it worked, but I thought that Lazarus was directly compatible with Delphi. My copy has reasonable Help files and examples, so if I can't work out how to create the Lazarus code, I go back to the Delphi help. In this case it hasn't worked. Is there a Lazarus equivalent of the Delphi Help? regards Roger