How can I use OpendDialog to place a song on a ListBox
-
Hi everyone...Can anyone of you help with this task because I started an application that supports audio and media format but I don't know how can I use OpendDialog to place a song on a ListBox... best wishes
Qendro
Hi! To just put the song's name in the listbox I suggest using the FileName from the OpenFileDialog and splitting it in order to extract the filename only, for example:
Dim OpenSong As New OpenFileDialog
OpenSong.ShowDialog()If Not OpenSong.CheckFileExists Then Exit Sub
If OpenSong.FileName = "" Then Exit SubDim SongSplit As Array = Split(OpenSong.FileName, "\")
Dim SongName As String = SongSplit(SongSplit.Length - 1).ToString
MyListBox.Items.Add(SongName)This Should Work, If All you want to do is add the song's name to a listbox, forgive me if I misunderstood your question. Hope This Helps! MrWolfy :-D
-
Hi everyone...Can anyone of you help with this task because I started an application that supports audio and media format but I don't know how can I use OpendDialog to place a song on a ListBox... best wishes
Qendro
-
Hi! To just put the song's name in the listbox I suggest using the FileName from the OpenFileDialog and splitting it in order to extract the filename only, for example:
Dim OpenSong As New OpenFileDialog
OpenSong.ShowDialog()If Not OpenSong.CheckFileExists Then Exit Sub
If OpenSong.FileName = "" Then Exit SubDim SongSplit As Array = Split(OpenSong.FileName, "\")
Dim SongName As String = SongSplit(SongSplit.Length - 1).ToString
MyListBox.Items.Add(SongName)This Should Work, If All you want to do is add the song's name to a listbox, forgive me if I misunderstood your question. Hope This Helps! MrWolfy :-D
There's always Path.GetFileNameWithoutExtension
Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.