我有一个程序里面包含有两个form(分别为form1,form2),我现在想在form2中用form1中的某个变量i,我要如何做?

解决方案 »

  1.   

    将这个要引用的变量放在public下面在form2引用时:变量:=form1.变量就可以了
      

  2.   

    you need uses unit file of form1 in unit file of form2
      

  3.   

    在unit2中uses Unit1;
    在单位一中:
    var
      Form1: TForm1;
      Gi:integer;
    这样这个Gi变量就可以两个单元中用
      

  4.   

    呵呵死方法就是定义全局变量
    form1 form2都可以调用
      

  5.   

    谢谢各位,特别是 mrfanghansheng(***Rocket***) and qiujsh(qiujsh)