access violation i kode
HejJeg har følgende kode:
procedure TForm1.next;
var
st : TStringList;
st1 : TStringList;
v:integer;
i:integer;
begin
if spmcount = spmselect then begin
showmessage('Du er færdig!');
start.BringToFront;
end
else begin
Randomize;
st1 := TStringList.Create;
st1.LoadFromFile('spm\oversigt.txt');
spmcount := spmcount + 1;
v:=random(flatlistbox2.Items.Count);
i:= random(strtoint(st1[v]));
i:= i + 1;
curentfile := 'spm\'+flatlistbox2.Items[v]+'_'+inttostr(i)+'.txt';
showmessage(curentfile);
st.LoadFromFile(curentfile);
spmlabel.Caption := inttostr(spmcount)+'/'+inttostr(spmselect);
spm.Caption := st[1];
valg1.Caption := st[3];
valg2.Caption := st[4];
valg3.Caption := st[5];
if st.Count > 6 then begin
valg4.Visible := true;
valg4.Caption := st[6];
end
else begin
valg4.Visible := false;
end;
end;
st.Free;
st1.Free;
end;
Men der kommer en access violation men jeg ved ikke hvad der er galt... Efter fejl meddelelsen køre det godt nok som den skal.
Mvh
Jesper
