我在运用Progressbar中程序出错,请帮改正!
begin
progressbar1:=tprogressbar.create(Self);
 try
progressbar1.parent:=self;
 progressbar1.Align:=albottom;
 progressbar1.min:=0;
 progressbar1.max:=total;
 progressbar1.step:=stepq;
 FOR I:=1 TO TOTAL DO PROGRESSBAR1.stepit;
 showmessage('ok');
 finally
 progressbar1.free;
 end;
 end;
出现undeclared indentifier"self"的错误

解决方案 »

  1.   

    progressbar1.parent:=form1 ;//这样写看看,直接写FORM的NAMEself;
      

  2.   

    你这段代码写的位置部队,一定要包含在一个form的方法中,也就是这段代码的方法前面必须要由form1.这个东东。
      

  3.   

    我看是因为你申明这个方法的问题。没有把他申明为类的方法,当然不知道self是什么了
      

  4.   

    千万别写成progressbar1.parent:=form1,虽然大部分情况下也能达到你想要得效果。但是form1很可能还没有被创建。
      

  5.   

    楼上说的对,过程必须是类的过程,否则把 self 改成form1.