delphi 提示variable "form2"might not have been initialized.一运行就提示错误并显示progect1program Project1;usesForms,Unit1 in 'Unit1.pas' {Form1};{$R *.res}beginApplication.Initialize;Application.CreateForm(TForm1,Form1);Application.Run;e
delphi 提示variable "form2"might not have been initialized.一运行就提示错误并显示progect1program Project1;usesForms,Unit1 in 'Unit1.pas' {Form1};{$R *.res}beginApplication.Initialize;Application.CreateForm(TForm1,Form1);Application.Run;e
delphi 提示variable "form2"might not have been initialized.
一运行就提示错误并显示progect1
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1,Form1);
Application.Run;
end.
在主程序中引用了form2
implementation
uses midaslib,Unit2,Unit3,unit4 ;
.
.
rocedure TForm1.Button1Click(Sender:TObject);
var i,y1,m1,y2,m2:integer;
form2:Tform2;
begin
try
form2:=Tform2.Create(self);
form2.ShowModal ;
.
.
form2.free
delphi 提示variable "form2"might not have been initialized.一运行就提示错误并显示progect1program Project1;usesForms,Unit1 in 'Unit1.pas' {Form1};{$R *.res}beginApplication.Initialize;Application.CreateForm(TForm1,Form1);Application.Run;e
DELPHI主菜单:prooject>Options>forms页,在auto-create forms列表框中,将form2移动到Available forms列表框中,就不会出现那提示了.