我發佈了一個問題修復了Delphi中的窗體中的方法聲明中的錯誤,但是在修復了編譯時彈出的另一個錯誤,並且它的項目project1.exe引發了異常類EStringListError有消息「列表索引越界(0)」。當我按下繼續其不工作,但是當我按下打破代碼neraz:=true;
其閃爍,這是我下面列表索引越界(0)
Procedure Reload;
var
i:integer;
begin
form1.ListBox1.Clear;
form1.ListBox2.Clear;
if neraz then
HD;
neraz:=true;//..................here
form1.Label3.Caption:='free: '+inttostr(vs*32)+' byte'+#10#13+'cluster size = 32 bytes';
i:=TABLE[nk1].nach;
KolP1:=0; KolP2:=0;
while (FAT[i]<>1024) do begin
if TABLE[fat[i]].tip then begin
form1.ListBox1.Items.Add('dir>'+TABLE[fat[i]].name);
inc(kolP1);
end
else
if TABLE[fat[i]].format='txt' then
form1.ListBox1.Items.Add('f_text> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format)
else
form1.ListBox1.Items.Add('f_bin> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format);
if (fat[i]<>0) then
i:=fat[i];
end;
i:=TABLE[nk2].nach;
while (FAT[i]<>1024) do begin
if TABLE[FAT[i]].tip then begin
form1.ListBox2.Items.Add('dir>'+TABLE[fat[i]].name);
inc(kolP2)
end
else
if TABLE[fat[i]].format='txt' then
form1.ListBox2.Items.Add('f_text> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format)
else
form1.ListBox2.Items.Add('f_bin> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format);
if (fat[i]<>0) then
i:=fat[i];
end;
vfail;
end;
procedure HD;
var
i: integer;
begin
for i := 0 to 49 do begin
with form2.ListView1.Items[i] do begin
SubItems[0] := TABLE[i].name;
SubItems[1] := TABLE[i].format;
if TABLE[i].tip then
SubItems[2] := 'folder'
else
SubItems[2] := 'file';
SubItems[3] := IntToStr(TABLE[i].nach);
SubItems[4] := IntToStr(TABLE[i].razmer);
end;
form2.ListView2.Items[i].SubItems[0] := IntToStr(fat[i]);
end;
end;
你的錯誤是'高清'。 – 2012-01-08 15:52:10
什麼是'HD'? – 2012-01-08 15:52:49
你的代碼是否真的格式化了?如果是這樣,那麼你迫切需要學習如何正確地縮進你的代碼。尤其是因爲您正在混合單個語句和複合語句塊。這使得人生在最好的時代變得艱難,但是沒有縮進紀律,你的代碼是不可維護的。 – 2012-01-08 15:56:06