Thanks. columns.add is what I use. It just gave me some problems in the beginning:
II was using this:
for i := 0 to q1.fieldcount -1 do
begin
AWG1.Columns.Add;
AWG1.Columns[ i ].Name := 'Col'+i.ToString;
AWG1.Columns[ i ].Title := q1.fields[ i ].fieldname;
AWG1.Columns[ i ].AllowSizing := false;
If i = 0 then AWG1.Columns[ i ].ColumnType := ctLink;
If i > 0 then AWG1.Columns[ i ].ColumnType := ctNoWrap;
AWG1.Columns[ i ].Width := GetTextLength(q1.fields[ i ].fieldname+'M');
end;
However, all columns ended up with the same properties. Not until I separated the adding from the property setting like below, did it work:
for i := 0 to q1.fieldcount -1 do
begin
AWG1.Columns.Add;
end;
for i := 0 to q1.fieldcount -1 do
begin
AWG1.Columns[ i ].Name := 'Col'+i.ToString;
AWG1.Columns[ i ].Title := q1.fields[ i ].fieldname;
AWG1.Columns[ i ].AllowSizing := false;
Strange isn't it.
(NB! Forum issue: writing a text containing [ i ], as in the above columns[ i ], I have to add a space on both sides of the "i" between the brackets. If not, the brackets and the "i" is removed and AWG1.Columns[ i ].AllowSizing := false; becomes AWG1.Columns.AllowSizing := false;
At least in the Preview Post).