delphi
procedure TForm1.AgregaralalistadeReproduccin1Click(Sender: TObject); var i: Integer; begin if grCanciones.SelCount > 0 then begin for pi := 0 to grCanciones.SelCount - 1 do begin AgregarALista(grCanciones.Items[pi].SubItems[8]); end; end; end;
Aquí estoy contando todos los items que están seleccionados e ir agregandolos con el procedimiento AgregarALista, que es el siguiente code:
delphi
procedure TForm1.AgregarALista(sFullPath: String); var obj : TmiObjeto; sFileName : string; begin obj := TmiObjeto.Create; obj.sPath := sFullPath; sFileName := '['+grCanciones.Items[pi].SubItems[2]+'] '+grCanciones.Items[pi].SubItems[3]+' - '+grCanciones.Items[pi].SubItems[1]; grLista.Items.AddObject(sFileName, TmiObjeto(obj)); end;
Pero al intentar agregar esos datos me da el siguiente error:
---------------------------
Debugger Exception Notification
---------------------------
Project Jukebox.exe raised exception class EStringListError with message 'List index out of bounds ( 8 )'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
No sé qué hago mal