Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How can I use OpendDialog to place a song on a ListBox

How can I use OpendDialog to place a song on a ListBox

Scheduled Pinned Locked Moved Visual Basic
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qendro
    wrote on last edited by
    #1

    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

    S B 2 Replies Last reply
    0
    • Q Qendro

      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

      S Offline
      S Offline
      Saul Johnson
      wrote on last edited by
      #2

      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 Sub

      Dim 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

      C 1 Reply Last reply
      0
      • Q Qendro

        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

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        Check this link.[^] Hope this will help you. Pershendetje


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        1 Reply Last reply
        0
        • S Saul Johnson

          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 Sub

          Dim 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

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          There's always Path.GetFileNameWithoutExtension

          Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups