Estoy practicando con TList y este código me da ese error. Por favor, ¿me podéis decir qué está mal?
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
Const
Const_A: Array[1..6] of String =( 'a', 'b', 'c', 'd', 'e', 'f');
var
I: Integer;
Element: Integer;
Lista: TList;
Dato : String;
begin
Memo1.Clear;
Randomize;
try
Lista := TList.Create();
try
for I := 1 to High(Const_A) do
begin
Lista.Add( Pointer( I ));
end;
repeat
Element := Random(Lista.Count);
Dato := Const_A[Element];
Memo1.Lines.Add( IntToStr (Element) +' '+ Dato ); Lista.Delete(Element);
until Lista.Count = 0;
finally
Lista.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end;
Quería hacer un TList de integers, pero no lo consigo.
Gracias por vuestra ayuda.
bulc