试试:
if not assigned(form2) then
  form2:=tform2.create(nil);

解决方案 »

  1.   

      Form2:=TForm2.Create(self);
      Form2.Show;
      Form2.Free;
      

  2.   

      Form2:=TForm2.Create(self);
      Form2.ShowModal;
      Form2.Free;
      

  3.   

    Form2.free;
    Form2:=nil;
    if not assigned(Form2) then
     begin
      Form2:=Form2.Create(application);
      Form2.Show;
     end;
      

  4.   

    implementationuses unit2;{$R *.dfm}
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if Form2=nil then
         Form2:=TForm2.Create(self); //self,application,nil都行
      Form2.Show;//记住:如果程序中有Form2.Free或者是在Form2的ONClose事件中用了
                 //Action:=caFree,则一定要加Form2:=nil.
    end;
      

  5.   

    if not Assigned(SomeForm) then begin
      Application.CreateForm(TSomeForm,SomeForm);
      try
        SomeForm.ShowModel;
      finally
        SomeForm.Free;
        SomeForm:=nil;
      end;
    end
    else
      SomeForm.ShowModal;
    end;如果用SHOW在onDestroy事件中将实例赋值为nil;