关于在登陆界面中使用Progressbar的问题 ( 积分: 100 )

  • 主题发起人 主题发起人 ganbaba
  • 开始时间 开始时间
G

ganbaba

Unregistered / Unconfirmed
GUEST, unregistred user!
有三个窗体,form1,form2,form3
form1有进度条progressbar1

dpr文件的内容是:
program Project1;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
Unit3 in 'Unit3.pas' {Form3};

{$R *.res}

begin
Application.Initialize;
with form1.Create(Forms.Application) do
try
ProgressBar1.Max:=30;
show;
Update;

Application.CreateForm(TForm1, Form1);
ProgressBar1.StepBy(10);

Application.CreateForm(TForm2, Form2);
ProgressBar1.StepBy(10);
Application.CreateForm(TForm3, Form3);
ProgressBar1.StepBy(10);
finally
Free;
end;
Application.Run;
end.
执行程序后出现下列错误:

Exception EAcessViolation in module Project1.exe at 0004DB67.
Access violation at address 0044DB67 in module 'Project1.exe'.Read of address 00000000.

请教如何解决,急!!!谢谢各位了
 
with form1.Create(Forms.Application) do
try
ProgressBar1.Max:=30;
这里的From1并未创建, 所以是报错
改成:
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
with form1 do
try
show;
Update;
ProgressBar1.Max:=30;
ProgressBar1.StepBy(10);

Application.CreateForm(TForm2, Form2);
ProgressBar1.StepBy(10);
Application.CreateForm(TForm3, Form3);
ProgressBar1.StepBy(10);
finally
Free;
end;
Application.Run;
end.
 
先创建带有进度条的窗体,然后在操作它
 
后退
顶部