同上

解决方案 »

  1.   

    在你的public申明下面定义就可以了,然后其他的窗体都use这个单元文件
    example :type
      ...
      private
      ...
      public
        s : string ; //全局变量
    ...
      

  2.   

    非常感谢,还想问一下USE怎么写。
      

  3.   

    打开需要调用全局变量的窗口,
    选菜单“FILE”,“USE UNIT”会自动调用USE。
    也可以在实现部分前面直接输入 USE FORM1;
    FORM1为全局变量所在的窗体。
      

  4.   

    书上说最好用单独的一个UNIT来存放全局变量,然后都去引用这个UNIT。
      

  5.   

    用上面的方法,USE程序不认,是不是USER,另,调用变量的窗口是不是还要变量声明。
      

  6.   

    应该是uses 单元名,但是不赞成这样使用全局变量!牵连太多!
      

  7.   

    unit1 ;var   ValusName : Type ;unit2 
    uses unit1 ;
      

  8.   

    定义一个Unit
    其他模块Use它就可以了
      

  9.   

    建议使用 wjlsmail 的方法~~SysUtils单元中部分全局变量~~
    var
      CurrencyString: string;
      CurrencyFormat: Byte;
      NegCurrFormat: Byte;
      ThousandSeparator: Char;
      DecimalSeparator: Char;
      CurrencyDecimals: Byte;
      DateSeparator: Char;
      ShortDateFormat: string;
      LongDateFormat: string;
      TimeSeparator: Char;
      TimeAMString: string;
      TimePMString: string;
      ShortTimeFormat: string;
      LongTimeFormat: string;
      ShortMonthNames: array[1..12] of string;
      LongMonthNames: array[1..12] of string;
      ShortDayNames: array[1..7] of string;
      LongDayNames: array[1..7] of string;
      SysLocale: TSysLocale;
      TwoDigitYearCenturyWindow: Word = 50;
      ListSeparator: Char;Forms单元中的部分全局变量~~
    var
      Application: TApplication;
      Screen: TScreen;这都是我们很熟悉的~~参考系统单元~~不是很好吗?~~
      

  10.   

    USES YOURUNIT
    最好不要用太多全局变量..
    KAO.,.伴水怎么变成四个星了..好快..
      

  11.   

    Linux2001(努力工作中...) 说的很对!
      

  12.   

    在任何单元的interface部分声明的变量或常量,都可以被所有引用该单元的任何单元访问到!