现在我有将一个文本插入数据表里,怎么能够使用ProgressBar。-------------------------------------------------------
if fileexists('c:\temp\d.txt') then begin
FlatButton2.Enabled:=false;
Screen.Cursor:=CrhourGlass;
adotable1.Connection:=ADOConnection1;
adotable1.TableName:='ckdb';
adotable1.Active:=true;
adotable1.Edit;
lines:=Tstringlist.Create;
lines.LoadFromFile('c:\card\temp\d14064.txt');
for i:=0 to pred(lines.Count-1) do begin
adotable1.Append;
s:=lines[i];
s2:=copy(s,10,16);
adotable1.FieldByName('hm').Value:=s2;
s2:=copy(s,40,12);
adotable1.FieldByName('state').Value:=s2;
s2:=copy(s,88,10);
adotable1.FieldByName('system').Value:=s2;
try
adotable1.UpdateRecord;
except
adotable1.Cancel;
end;
---------------------------------------------------
怎么用ProgressBar,开始是i:=0,结束i:=lines.Count-1
if fileexists('c:\temp\d.txt') then begin
FlatButton2.Enabled:=false;
Screen.Cursor:=CrhourGlass;
adotable1.Connection:=ADOConnection1;
adotable1.TableName:='ckdb';
adotable1.Active:=true;
adotable1.Edit;
lines:=Tstringlist.Create;
lines.LoadFromFile('c:\card\temp\d14064.txt');
for i:=0 to pred(lines.Count-1) do begin
adotable1.Append;
s:=lines[i];
s2:=copy(s,10,16);
adotable1.FieldByName('hm').Value:=s2;
s2:=copy(s,40,12);
adotable1.FieldByName('state').Value:=s2;
s2:=copy(s,88,10);
adotable1.FieldByName('system').Value:=s2;
try
adotable1.UpdateRecord;
except
adotable1.Cancel;
end;
---------------------------------------------------
怎么用ProgressBar,开始是i:=0,结束i:=lines.Count-1
progressbar1.stepit;
for循环外设置
progressbar1.max := lines.count - 1;
progressbar1.min := 1;
progressbar1.step:= 1;
repeat
progressbar1.Position:=progressbar1.Position +1;
i:=i-1;
until i=lines.count-1;