Ver Mensaje Individual
  #5  
Antiguo 22-07-2007
Avatar de ariefez
ariefez ariefez is offline
Miembro
 
Registrado: sep 2005
Ubicación: Perú - Lima
Posts: 63
Reputación: 19
ariefez Va por buen camino
Pues no le veo utilidad a las unidades QComCtrls, QDBGrids, o almenos a mi no me las reconoce , en vez de eso use ComCtrls, DBGrids y corre normal, te pego el codigo sin esas unidades. una cosa mas para liberar, se usa la rutina Free o FreeAndNil... un consejo al escribir tu mensaje resalta tu codigo con el boton Resaltar sintaxis delphi y quedara mas legible, suerte que existe Jedi Code Format, sino, no seria legible tu codigo.

Código Delphi [-]
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, DB, DBGrids;

type
  TForm2 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2:      TForm2;
  PCInformacion: TPageControl;
  DTPFecha:   TDateTimePicker;
  Hoja1, Hoja2: TTabSheet;
  DataSource: TDataSource;
  DBGDatos:   TDBGrid;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
  PCInformacion := TPageControl.Create(Self);
  with PCInformacion do
  begin
    Parent := Form2;
    Align  := AlClient;
  end;
  Hoja1 := TTabSheet.Create(PCInformacion);
  with Hoja1 do
  begin
    PageControl := PCInformacion;
    Caption     := 'Hola Mundo';
    DTPFecha    := TDateTimePicker.Create(Self);
    DBGDatos    := TDBGrid.Create(Self);
    DataSource  := TDataSource.Create(Self);
    DTPFecha.Parent := Hoja1;
    DBGDatos.Parent := Hoja1; // aqui es donde sale el error mencionado en la pregunta
  end;
  Hoja2 := TTabSheet.Create(PCInformacion);
  with Hoja2 do
  begin
    PageControl := PCInformacion;
    Caption     := 'Hola Mundo en la Hoja 2';
  end;
end;

procedure TForm2.FormDestroy(Sender: TObject);
begin
  DTPFecha.Free;
  Hoja1.Free;
  Hoja2.Free;
  PCInformacion.Free;
end;

end.

Una cosa mas al crear los controles, debes darles las coordenadas y dimensiones sino no los vaz a ver o van estar desordenados

Última edición por ariefez fecha: 22-07-2007 a las 16:12:38.
Responder Con Cita