Ver Mensaje Individual
  #2  
Antiguo 30-11-2007
[maeyanes] maeyanes is offline
Capo de los Capos
 
Registrado: may 2003
Ubicación: Campeche, México
Posts: 2.732
Reputación: 24
maeyanes Va por buen camino
Hola...

Teniendo el nombre del componente, puedes usar la función FindComponent o crearte una que te devuelva un TDataSet:

Código Delphi [-]
function TDataModule1.DataSetByName(const AName: string): TDataSet;
var
  I: Integer;

begin 
  for I := 0 to Pred(ComponentCount) do
    if (Components[i] is TDataSet) and (Components[i].Name = AName) then
    begin
      Result := TDataSet(Components[i])
      Exit
    end;
  Result := nil
end;

Luego desde la forma en cuestion haces:

Código Delphi [-]
DataSource1.DataSet := DataModule1.DataSetByName('DatosCliente')

Usando FindComponent sería algo así:

Código Delphi [-]
DataSource1.DataSet := DataModule1.FindComponent('DatosCliente') as TDataSet



Saludos...
Responder Con Cita