Control '' has no parent window

> I'm having a problem with a component.
> My component inherits from the TPanel class.
> In the constructor I'm trying to do this:
> var
>   dbLCmb : TDBLookupComboBox ;
> begin
>   dbLCmb := TDBLookupComboBox .Create(nil);

>   dbLCmb.parent := Self;
>   dbLCmb.Left := 0;  //  This line, or next, causes the message: Control ''
> has no parent window
>   dbLCmb.Top := 0;
> end;
> What's the problem ? If I change TDBLookupComboBox to TLable for exemple
> evething runs OK.


Delphi is telling the truth: the control has no parent window (the window
handle is not yet available) in the constructor. But setting the Left
property tries to access it. Change the sequence of statements and set the
Parent as the very last statement. As long as the Parent is Nil setting the
control bounds will not attempt to access the parent.handle.

Peter Below (TeamB)