Board index » delphi » DBGrid columns

DBGrid columns

I use the function 'Table1.FieldDefs.Add('Inv', ftString, 9, False);'
to name a table column.  I need to simply change the 'Inv' field to read
'Profit'.   How is this done? - Thanks.
 

Re:DBGrid columns


Quote
On Fri, 29 Oct 1999 12:24:58 GMT, John <W...@arrl.net> wrote:
>I use the function 'Table1.FieldDefs.Add('Inv', ftString, 9, False);'
>to name a table column.  I need to simply change the 'Inv' field to read
>'Profit'.   How is this done? - Thanks.

One way is to set the TField.DisplayLabel property to the text you wish to
be used as the field's display name. This value is what is displayed in the
title for a TDBGrid column.

  Table1.FieldByName('Inv').DisplayLabel := 'Profit';

Another way, one that only affects the one TDBGrid, is to set the Caption
property of one of the column objects. For example:

  DBGrid1.Columns[0].Title.Caption := 'Profit';

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Health nuts are going to feel stupid someday,
Felton, CA                  lying in hospitals dying of nothing."
                                                              -- Redd Foxx

Other Threads