Board index » delphi » Adding a calculated field to DBGrid

Adding a calculated field to DBGrid

How to add a calculated field to a DBGrid in Delphi 5?  I need to add a
column containing a name that is derived from another field in another
column on the grid.

Don Murphy
Applied Computing Services

 

Re:Adding a calculated field to DBGrid


Don,

just add calculated field in linked dataset and in OnCalcField event fill a
value for this field. In this case DBGrid will display such column without
any problems

--
With best regards, Mike Shkolnik
E-mail: mshkol...@scalabium.com
WEB: http://www.scalabium.com

Quote
"don" <d...@pma2000.com> wrote in message

news:3fad44b0@newsgroups.borland.com...
Quote
> How to add a calculated field to a DBGrid in Delphi 5?  I need to add a
> column containing a name that is derived from another field in another
> column on the grid.

> Don Murphy
> Applied Computing Services

Re:Adding a calculated field to DBGrid


You do not add calculated fields to the grid. Instead you add them to
the TTable that supplies data to the grid. Double click the TTable to
open the fields editor then right click and add all fields. Now you
can right click again and add a calculated field. Last, create an
OnCalcFields event handler for the TTable and assign a value to the
calculated field.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Other Threads