Advertisement
lesharb

TField Create Dynamic

Apr 20th, 2011
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.40 KB | None | 0 0
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   Field: TField;
  4.   i: Integer;
  5. begin
  6.   Table1.Active:=False;
  7.   for i:=0 to Table1.FieldDefs.Count-1 do
  8.     Field:=Table1.FieldDefs[i].CreateField(Table1);
  9.   Field:=TStringField.Create(Table1);
  10.   with Field do
  11.   begin
  12.     FieldName:='New Field';
  13.     Calculated:=True;
  14.     DataSet:=Table1;
  15.   end;
  16.   Table1.Active:=True;
  17. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement