Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Create DBGrid columns at runtime

1,500 views
Skip to first unread message

Lawrence Kohn

unread,
Apr 21, 1999, 3:00:00 AM4/21/99
to
I want to create only certain columns on my grid at runtime, and set them to
my table field(s). How do you do that. Grid.Columns.Create(Grid, tColomn)
doesn't do it.

Thanks.

Lou

unread,
Apr 21, 1999, 3:00:00 AM4/21/99
to
Try it like this:
DBGrid1.Columns.Add;
DBGrid1.Columns[0].FieldName := 'FieldName1';

I have a few TDBGrid tips on my Delphi Tip of the Day webpage at
http://members.truepath.com/delphi

I also have a daily email list to let you knoe the days tip title,
description, and a link to it if you are interested.

--
--
Lewis Howell
lewis...@yahoo.com
Lou's Delphi Tip of the Day:
http://members.truepath.com/delphi
Lou's personal webpage:
http://members.truepath.com/LewisHowell

Lawrence Kohn wrote in message <7fjnf8$3m...@forums.borland.com>...

Mike Shkolnik

unread,
Apr 21, 1999, 3:00:00 AM4/21/99
to
Look on my example:

with SMDBGrid.Columns.Add do
begin
FieldName := 'Name';
Width := 150;

Title.Caption := 'Name of newsgroup*'
Title.Alignment := taCenter;

PickList.Add('borland.public.delphi.vcl.components.using');
PickList.Add('borland.public.delphi.vcl.components.writing');
PickList.Add('borland.public.delphi.graphics');
PickList.Add('borland.public.delphi.database.sqlservers');
PickList.Add('borland.public.delphi.thirdparty-tools');
Color := TColor($C0DCC0); //clMoneyGreen
end;

--
With best regards, Mike Shkolnik.
FIDO: 2:463/106.14
E-Mail: mshk...@rs-ukraine.kiev.ua
mi...@woccu.freenet.kiev.ua
WEB: http://www.geocities.com/SiliconValley/Grid/3989

Lawrence Kohn пишет в сообщении <7fjnf8$3m...@forums.borland.com> ...

Andreas Pawlik

unread,
Apr 21, 1999, 3:00:00 AM4/21/99
to
Lawrence Kohn wrote:
>
> Grid.Columns.Create(Grid, tColomn) doesn't do it.

Try Grid1.Columns.Add .

0 new messages