unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
//这里定义
  temp:String;implementation{$R *.dfm}end.
在form2的implementation下面写上uses unit1
就没有问题了呀,
注意,不要在定义temp的非全局变量了。

解决方案 »

  1.   

    在form2中uses form1,然后
    form1.temp 就可以了
      

  2.   

    你先在form1的public 下面定义一个变量。public
    i:integer;然后在form2的impelment 下面uses form1.然后在form2放一个buttom
    在button的click里调用 form1.i:=5;
      

  3.   

    不明白你所说的没有是什么意思,是form1.后没有列出temp变量吗?如果是这样,不用担心的,自己写上form1.temp就可以,当然,前提是必须保证你的全局变量定义和单元引用是正确的
      

  4.   

    比如要在form2中引用form1的变量,则在form2的代码中加入:uses unit1
      

  5.   

    先在form1的public 下面定义一个变量。public
    i:integer;然后在form2中use form1可以引用了
      

  6.   

    谢谢,已经可以了,如果在
    var
      Form1: TForm1;
    //这里定义
      temp:String;
    那么走form2中就应该用temp,不是form1.temp;
    如果是在public中定义,就应该用form1.temp;
    我已经给分了,
      

  7.   

    方法(1)
      全局變量傳值.
    方法(2)
      edit等控件傳值,設visible:=False  .