Link to home
Start Free TrialLog in
Avatar of Imbeginner
Imbeginner

asked on

creating dbgrid columns at running time

hello,
I cant  create dbgrib columns at running time,
Do any sample that describe it for  me,
 I need these features for my dbgrid columns
1:the change of header column
2:decreament the dataset fields(show less than dataset fields)

any one have a sample for this work?

Thanks
m.reza
ASKER CERTIFIED SOLUTION
Avatar of Hardi
Hardi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of da-vinci
da-vinci

Also creating is quite easy:

Delphi syntax:
function Add: TColumn;

Description
Add returns the new column.

After you have created the new column you can edit any property you like by using the index.
The column you added has always the following itemindex:
DBGrid1.Columns[DBGrid1.Columns.Count-1]

Simple:

Grid1.Columns.Add.FieldName:='MyColumn'; // My name
Grid1.Columns.Add.Width:=250;  //My width
Avatar of Imbeginner

ASKER

thanks for your good answer