Directories and Listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacobevans
    New Member
    • Aug 2007
    • 26

    Directories and Listbox

    I want to be able to have someone click a command button, then have a directory form show, that part is complete. Now i need help adding all the files in this directory to a list with the extensions ".mp3, .wav, and .mid". this is what i have so far.

    [CODE=vb]Private Sub cmdAddDir_Click ()
    Dim di As New IO
    .DirectoryInfo ("c:\")
    Dim diar1 As IO
    .FileInfo() = di.GetFiles("*. mp3", "*.wav", "*.mid")
    Dim dra As IO.FileInfo
    For Each dra In diar1
    lstSongs.Items. Add (dra)
    Next
    End Sub[/CODE]

    any hints or tips would be appreciated

    -Jacob
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    You've told us what you're doing. Can you tell us what your problem is?

    Comment

    • jacobevans
      New Member
      • Aug 2007
      • 26

      #3
      Originally posted by Killer42
      You've told us what you're doing. Can you tell us what your problem is?

      haha sorry about that.

      i get a compile error, user-defined type not defined

      is there any easier way to do what im doing?

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        Originally posted by jacobevans
        haha sorry about that.

        i get a compile error, user-defined type not defined

        is there any easier way to do what im doing?
        user-defined type not defined

        It comes missing some references. I think you didn't reffer FSO.

        can you post which version?

        Comment

        • ngchaitra
          New Member
          • May 2007
          • 16

          #5
          I am working in asp.net 2.0 and using vb script.

          Comment

          • hariharanmca
            Top Contributor
            • Dec 2006
            • 1977

            #6
            Originally posted by ngchaitra
            I am working in asp.net 2.0 and using vb script.
            Debug and just point which piece of code throwing this error.

            (I think, this error will come at build time)

            Just check all reference are there

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by hariharanmca
              Debug and just point which piece of code throwing this error.

              (I think, this error will come at build time)

              Just check all reference are there
              I'm not sure VBScript has any concept of "build time" - isn't it interpreted at runtime?

              But I agree, we need to know which statement/reference is throwing the error.

              Comment

              • jacobevans
                New Member
                • Aug 2007
                • 26

                #8
                Dim di As New IO
                is where its erroring

                im not sure what you mean by version but im running VB6 32 bit

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Originally posted by jacobevans
                  Dim di As New IO
                  is where its erroring

                  im not sure what you mean by version but im running VB6 32 bit
                  I use VB6, and I'm not aware of any object type of IO. In fact I've just tested and got the same error. Either you've got the type (IO) wrong, or you need to add a reference to the library that contains it.

                  Also, we need to sort something out. Are you using VBScript or VB? They are quite similar, but not the same thing.

                  Comment

                  • jacobevans
                    New Member
                    • Aug 2007
                    • 26

                    #10
                    Im for sures using visual basic 6.0

                    Comment

                    • jacobevans
                      New Member
                      • Aug 2007
                      • 26

                      #11
                      Originally posted by jacobevans
                      Im for sures using visual basic 6.0

                      and i know this is off topic but does anyone know how to run the moosock2.ocx socket on vb6?

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Originally posted by jacobevans
                        and i know this is off topic but does anyone know how to run the moosock2.ocx socket on vb6?
                        Well I've never heard of it.

                        I'd suggest you open a new discussion for this. A lot of people won't be bothering to read this one, either because the title doesn't interest them, or because the number of replies indicates it is already being dealt with.

                        Comment

                        Working...