初学程序经常不能运行,unit2是打印预览preview是好的,unit1不能运行调动unit2(100分)

  • 主题发起人 sharkboy
  • 开始时间
S

sharkboy

Unregistered / Unconfirmed
GUEST, unregistred user!
初学程序经常不能运行,unit2是打印预览preview是好的
unit1不能运行重建了几次不行
unit1如下
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation
uses unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
form2.quickrep.preview
end;

end.
form2、quickrep都和unit2中控件名是对应的,也不报错,只是一运行就退出来还是编辑
 
Form2创建了吗?
 
不是说了吗,form2在unit2中
 
form2应该是动态创建的,问题就出现在form2没有创建上。所以出错。你把unit2贴出来看看。
 
他的意思是说在form2.quickrep.preview这句之前有没有
Application.CreateForm(Tform2,form2)这样的语句;
 
有没有搞错啊, 你的USE语句中没有包括 UNIT2 ???
 
找找其它的原因,也许错误不是出在这里
 
在form2.quickrep.preview这句之前加
Application.CreateForm(Tform2,form2)
 
顶部