只用var 声明变量就可以在别的unit 中直接引用,不过前提是你得在你要用该变量的unit中的uses中加入那个变量所在的unit名称,如果本unit也有同名变量,这变量前加限定符

解决方案 »

  1.   

    请问如何在USES 中声明 请写出源码好吗
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
      TForm1 = class(TForm)
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
       Uses 变量why所在的单元名;
    {$R *.DFM}
    procedure TForm1.xxx ;
    begin
      变量why所在的窗体名.why :=...;
    end;
    end.