Board index » delphi » Control '' has no parent window

Control '' has no parent window

Hi there, I have a problem, when I create a DBLookupComboBox I always get an
Control '' has no parent, any idea???. This is the code i use to create the
DBLookupComboBox:

dbPais:=TDBLookupComboBox.Create(Self);
with dbPais do
begin
      Parent:=Self;
      Left     := 84;
      Top      := 198;
      Width    := 121;
      Height   := 21;
      TabOrder := 9;
      ListSource:=dsMidas2;
      ListField:='paDescri';
      KeyField:='paCodigo';
      datasource:=dsMidas;
      datafield:='diPais';
      Show;
end;

Thanks in advance.

-Isabel

PS. If I cut Parent:=Self it works fine.

 

Re:Control '' has no parent window


Quote
"isabel gmez" wrote:
> Hi there, I have a problem, when I create a DBLookupComboBox I always get an
> Control '' has no parent, any idea???. This is the code i use to create the
> DBLookupComboBox:

> dbPais:=TDBLookupComboBox.Create(Self);
> with dbPais do
> begin
>       Parent:=Self;
>       Left     := 84;
>       Top      := 198;
>       Width    := 121;
>       Height   := 21;
>       TabOrder := 9;
>       ListSource:=dsMidas2;
>       ListField:='paDescri';
>       KeyField:='paCodigo';
>       datasource:=dsMidas;
>       datafield:='diPais';
>       Show;
> end;

> Thanks in advance.

> -Isabel

> PS. If I cut Parent:=Self it works fine.

Isabel,

So, the problems is in the "self" parameter.   Delphi help states the "Self
references the object in which the method is called".  In class methods "Self
represents the class where the method is called".

So you need to see: what in the world is self when you use it?

Victor H. Ulloa
Tierra Fertil S.A.

Other Threads