Help with a listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matthewfrance7
    New Member
    • Nov 2007
    • 5

    Help with a listbox

    This code is supposed to open a specific file, in this case an MP3 file but then show it in a list box. But it isn't working!!

    Private Sub btnAddFile_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnAddFile.Clic k

    Dim OpenFile As New OpenFileDialog
    Dim file As String

    OpenFile.Initia lDirectory = "C:\Documen ts and Settings\Matth\ My Documents\test1 \"
    OpenFile.Filter = "MP3 Files (*.mp3)|*.MP3"
    OpenFile.Filter Index = 1
    OpenFile.Restor eDirectory = True
    OpenFile.Multis elect = True

    If OpenFile.ShowDi alog() = Windows.Forms.D ialogResult.OK Then


    For Each file In OpenFile.FileNa mes
    ListBox.Items.A dd(file)
    Next
    End
    End If


    Could someone help me with this problem please??
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    have you tried:

    openfile.show
    or
    openfile.visibl e = True

    ¿?

    (dont remember which one works here)

    Comment

    • matthewfrance7
      New Member
      • Nov 2007
      • 5

      #3
      Neither of those worked unfortunately.

      'FileList.Items .Add(file)' is coming up as underlined and when I take it out, the files are opened but not shown in the list box

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by matthewfrance7
        Neither of those worked unfortunately.

        'FileList.Items .Add(file)' is coming up as underlined and when I take it out, the files are opened but not shown in the list box
        Sorry, i didnt see that, this might be of help:

        OpenFile.Filter .add "MP3 Files (*.mp3)", "*.MP3"

        Comment

        Working...