wieso der Umweg über die TStringList?
Ich hoffe doch du hast die Edits in nem Array?
Delphi-Quellcode:
TData = array [1..30] of record Name: String; FileName: String; end;
var Data: TData;
//Init
procedure Init;
var i:Integer;
begin
for i:=1 to 30 do
begin
Data[i].Name:=Edits_Name[i].Text;
Data[i].FileName:=Edits_File[i].Text;
end;
end;
procedure GenFrage;
var ID, Cnt: Integer;
Names: array [1..4] of String;
begin
ID:=Random(30)+1;
Image.LoadFromFile(Data[ID].FileName); //Bild laden
Names[1]:=Data[ID].Name;
Cnt:=1;
while Cnt<4 do
begin
ID:=Random(30)+1;
if (Data[ID].Name<>Names[1]) and (Data[ID].Name<>Names[2]) and (Data[ID].Name<>Names[3]) and (Data[ID].Name<>Names[4]) then
begin
Inc(Cnt);
Names[Cnt]:=Data[ID].Name;
end;
end;
Shuffle(Names); //Mischen...such mal in der CodeLib ;)
Lst_Antworten.Clear;
for ID:=1 to 4 do
Lst_Antworten.Items.Add(Names[ID]); //Antworten dazutun
end;