Re: Re: Form create


Posted by webmaster Guido on April 10, 2001 at 18:46:55:

In Reply to: Re: Form create posted by JC Servaye on April 05, 2001 at 14:54:11:

: : First I create form1 with a button that calls form2.
: : Then I set the form2 as the "available forms",not "autocreate forms".

: : TForm1.Button1Click();
: : begin
: : form2:=Tform2.create(self); <--------- error here
: : form2.showmodal;
: : form2.free;
: : end;

: : But it shows me it's wrong.Why?
-----------------------

The line "form2 := Tform2.create(self);" is not wrong. When creating a form, you always have to specify its "owner", and it is allowed to define Form1 as the owner of Form2.

So, something else must be wrong:
- does your application contain a .pas file and a dfm-file for Form2?
- if yes, make sure that the name of the unit for TForm2 is in the uses-statement of the unit for Form1.

 


Related Articles and Replies: