Hola maeyanes,
He modificado el codigo a:
Código Delphi
[-]
if BrandsLst.Count > 0 then
BrandsLst.Clear
Tal y como te indique, no tengo ningún registro en la tabla brands, no me muevo por los registros maestros, y cierro el form y todo bien, al abrir otra vez el formulario me da un error en ese mismo fragmento de código.
Yo para liberar el BrandsLst, hago lo siguiente:
Código Delphi
[-]
procedure TfmHorses.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
if Assigned(BrandsLst) then
BrandsLst.Free;
end;
Este hereda de:
Código Delphi
[-]
procedure TfmAncestor.FormClose(Sender: TObject; var Action: TCloseAction);
var
I: Integer;
C: TComponent;
begin
Action := TCloseAction.caFree;
for I := 0 to ComponentCount - 1 do
begin
C := Components[i];
if (C is TDataSource) and (Assigned(TDataSource(C).DataSet)) then
begin
TDataSource(C).DataSet.Close;
if TDataSource(C).Name = 'dsAllRows' then
with TDataSource(C).DataSet as TClientDataSet do
CommandText := SQL;
end;
end;
end;