我发布了一个问题修复了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