在该Button的OnClick事件中写代码:
Form2.show;
或者在工程启动时不创建Form2,同样在Button的OnClick事件中写代码:
Form2 := TForm2.Create(self);
Form2.show;
这样更好。

解决方案 »

  1.   

    form1所在的单元还要uses form2所在的单元。
      

  2.   

    在Form1中先Uses Form2这个单元
    1.Form1作为主窗口
    2.Button的OnClick事件:Form2.show;(或showmodal)
    或:工程外创建
     if not asssign(Form2) then
     begin
      Form2 := TForm2.Create(self);
      Form2.show; 
     end else Form2.Free; 
      

  3.   

    在Form1中先Uses Form2这个单元
    1.Form1作为主窗口
    2.Button的OnClick事件:Form2.show;(或showmodal)
    或:工程外创建
     if not asssign(Form2) then
     begin
      Form2 := TForm2.Create(TForm2, Form2);
        Try
           Form2.showModal;
        Finally
          Form2.free;
          Form2:=NIL; 
        end;
     end else Form2.show;