主题:请问DELPHI如果引用其它表变量
我的FROM1为登陆表单。我的FROM需要引用FROM1的登陆ID。我想在FROM1里设一变量储存登陆ID。然后FROM2再引用这个变量。
看书上说在INTERFACE里定义变量就可以让其他FROM引用。但我还是引用不了。
(FROM1)
unit Login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,DateModule,BookLend;
Var
LoginID:string;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
UName: TEdit;
Upwd: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
count:integer;
{$R *.dfm}
(FROM2)
unit BookLend;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DateModule,Grids, DBGrids, StdCtrls, ExtCtrls, DBCtrls, Mask,
ComCtrls, DB,ADODB;
type
TBook_lend = class(TForm)
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
BookLendQuery: TADOQuery;
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
{ Private declarations }
public
{ Public declarations }
end;
var
Book_lend: TBook_lend;
implementation
uses
login;
{$R *.dfm}
请问应该怎样修改?
看书上说在INTERFACE里定义变量就可以让其他FROM引用。但我还是引用不了。
(FROM1)
unit Login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,DateModule,BookLend;
Var
LoginID:string;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
UName: TEdit;
Upwd: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
count:integer;
{$R *.dfm}
(FROM2)
unit BookLend;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DateModule,Grids, DBGrids, StdCtrls, ExtCtrls, DBCtrls, Mask,
ComCtrls, DB,ADODB;
type
TBook_lend = class(TForm)
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
BookLendQuery: TADOQuery;
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
{ Private declarations }
public
{ Public declarations }
end;
var
Book_lend: TBook_lend;
implementation
uses
login;
{$R *.dfm}
请问应该怎样修改?