在Unit1的public中声明变量,在Unit2中uses Unit1就可以直接用了

解决方案 »

  1.   

    1.要在unit2中使用unit1中定义的全局变量,只需在unit2的uses中加入unit1即可。如在unit1中声明如下:
    unit unit1;
    ....      
    var  Form1: TForm1;
      yy:string;implementation
    那么在unit2中的直接使用为:
    uses
       ...,Unit1,...;
    type
      TForm1 = class(TForm)
        Button1: TButton;
        ...
    procedure TForm1.Button1Click(Sender: TObject);
    begin
        yy:='afasfd';
        ShowMessage(yy);
    end;2.
    我也不太清楚,等待别人的回答
      

  2.   

    1. 在PUBLIC中定义,并在B中USES A
    2. 加入什么东东,将按纽隐藏