hello guys can you help me with my problem
i create a media player and of course it has a playlist which is the listbox but my problem is that when i use this

x = system.io.path.getfilename(track)

and when i click the song in the playlist it does not play the song...

for the song is from C:\blah\this is war.mp3

with this code playlist.selecteditem.add(track) it will output in the playlist(listbox) is the C:\blah\this is war.mp3 and when i click that of course it will play the song

but.....

when i use this

x = system.io.path.getfilename(track)  
 playlist.selecteditem.add(x)

it will output in the playlist(listbox)
this is war.mp3 <-- it remove the c:\blah\
but the problem is that it does not play the song..

Can someone help me with problem?

x = system.io.path.getfilename(track) will only give you the filename.

If you want to display only the filename, but still have access to the full path, then I suggest that you add a second, hidden, ListBox where you store the full path and filename.
And every time that you add another track to the playlist, then at the same time add the full path to the second ListBox using the "track" string.

So, when you click the song in the playlist, the song gets played from the second ListBox.

thanks guys but I already solve the problem using two listbox the first listbox use the system.io.path.getfilename and the other one not use and in the selected listbox which use the system.io.path.getfilename when the item is selected it will also select the lsitbox2------> [code] listbox1.selecteditem = listbox2.selecteditem [\code] same idea with you oxiegen:) and also codeorder thank to the link another algorithm:)

This question has already been answered. Start a new discussion instead.