Use other forms' variables

unit Unit1;
...
var
   Form1: TForm1;
   hello: string;

implementation

{$R *.DFM}

end.

----------------------------------------------------------------------

unit Unit2;

interface

uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Unit1;
...

var
   Form2: TForm2;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
     //Use Unit1's variable here
     Unit1.hello:='abcdefg';
end;

end.

 

Copyright 2001-2005 (C) ykwong.com All rights reserved.