I have a PageControl with five-tabs. Three of the tabs have a DBGrid, all using the same columns and DataSource. When a user clicks on a Title I change IndexFieldNames and Bold the appropriate Title. Currently I am doing...
for i:=0 to dbg1.Columns..Count-1 do
begin
dbg1.Columns[i].Title.Font.Style:=[];
dbg2.Columns[i].Title.Font.Style:=[];
dbg3.Columns[i].Title.Font.Style:=[];
end;
dbg1.Columns[Column.Index].Title.Font.Style:=[fsBold];
dbg2.Columns[Column.Index].Title.Font.Style:=[fsBold];
dbg1.Columns[Column.Index].Title.Font.Style:=[fsBold];
tblCustomer.IndexFieldNames:=Column.Name;
But, it has occurred to me that I could just have one DBGrid and swap the Parent as needed in the PageControl OnChange event.
dgb1.Parent:=TabSheet1;
or
dgb1.Parent:=TabSheet2;
Is there a down side to doing this? The Parent could be changed many dozens of times in one sitting.