Page 1 of 1

Problem in vb.net

Posted: Tue Jun 10, 2008 3:52 pm
by Dagger13
Ok so im making a program all it is is a music player,ok so i made it so when i click add folder it will add the music in that folder and show the name,lenght,artist,album, and year in the listview for all songs
and when i click to play a song it works but then when i click another song
i get an error (it dosnt matter witch song)the error says
InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index
and what im doing is making the music player read the selected items tooltip(because it shows full filename)


and this is what im using for code that messes up

Code: Select all

 Me.AxQTControl1.FileName = lv.SelectedItems.Item(0).ToolTipText
ik that part is easy

Posted: Tue Jun 10, 2008 5:03 pm
by Andrew_b
wont that only play item 0?

Posted: Tue Jun 10, 2008 6:05 pm
by FleetAdmiralBacon
@Andrew_b: No, as it's the array of selected items, it'll be the first one selected.

@Dagger: You may be trying to grab from the selection before it exists. Check that there are any items selected (that the array isn't empty) before referencing anything by index.

Posted: Tue Jun 10, 2008 6:18 pm
by Andrew_b
FleetAdmiralBacon wrote:@Andrew_b: No, as it's the array of selected items, it'll be the first one selected.
Ok, that makes sense.

Posted: Tue Jun 10, 2008 8:35 pm
by Dagger13
Lol ok thx AdmiralBacon
all i had to do was make it so when i double click it it would do what i want it to.

Thanks :D