Field DisplayLabel when assigning datasets, Question.
Posted: Tue 09 Feb 2010 10:09
Hello once more.
I met following problem. When I assign one VT to another, the property of DisplayLabel isn't copied. So such code can produce different results:
I presume it is some limitation of assigning or even it is obvious behaviour if only table data is copied. The question is, if there is a simple solution to copy DisplayLabel fields property instead of code:
I met following problem. When I assign one VT to another, the property of DisplayLabel isn't copied. So such code can produce different results:
Code: Select all
V2 := TVirtualTable.Create(Self);
V2.Assign(V1);
ShowMessage( V1.FieldByName('anyfield').DisplayLabel );
ShowMessage( V2.FieldByName('anyfield').DisplayLabel );
Code: Select all
procedure CopyDisplayLabels(ds1, ds2: TDataSet);
var
i: Integer;
begin
for i := 0 to ds1.FieldCount - 1 do
ds2.Fields[i].DisplayLabel := ds1.Fields[i].DisplayLabel
end;