BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Defining a look-up field in a DBGrid...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Guillem
Guest





PostPosted: Thu Nov 27, 2003 3:43 pm    Post subject: Defining a look-up field in a DBGrid... Reply with quote



Hi!

How can I define a look-up field in a TDBGrid at run-time? I know I can do
it at design time but I need to do it at execution time (before populating
the grid).

Any suggestions? Thanks in advance!
Guillem


Back to top
Quasidata
Guest





PostPosted: Fri Nov 28, 2003 5:38 am    Post subject: Re: Defining a look-up field in a DBGrid... Reply with quote



Hello Guillem,

Depends whether there are persistent columns created at design time or
they are created dynamically at the moment when you populating your grid.
Dynamic columns do not exist until you open the dataset, they are created
automatically based on fields in the underlying dataset. You can find a
column by iterating through MyDBGrid.Columns[] and looking for the
column's FieldName property value.

It depends also on whether you need to populate the pick list with
external values or to use values from an existing lookup field. In the
later case, you do not need to do anything. In the former case, find the
column by the FieldName value and add values to its PickList property by
code, like
MyDBGrid.Columns[MyColumnIndex].PickList.Add('MyValue');

Also, see topic in the help file
Developing Database Applications -> Using Data Controls -> Defining a
lookup list column

--
Andrei Fomine www.quasidata.com
DbAltGrid - multi-line layout, RTF and graphics of any kind in DBGrid.
Transfer@Once - full-blown clipboard and drag-and-drop data transfer
to/from any control in many formats, including ones native to MS Office.


"Guillem" <keinname (AT) eresmas (DOT) net> wrote

Quote:
Hi!

How can I define a look-up field in a TDBGrid at run-time? I know I can
do
it at design time but I need to do it at execution time (before
populating
the grid).

Any suggestions? Thanks in advance!
Guillem




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.