Results 1 to 4 of 4

Thread: File and Dir Listing

  1. #1
    rsitogp
    Guest

    Question File and Dir Listing

    Hello,

    I'm working on a small prog that'll list dirs and the files in them, I used the following code to list the dirs but couldn't get it going with files too:
    Code:
    Private Sub Command1_Click()
     For i = Dir2.ListIndex To Dir2.ListCount - 1
      If Text1.Text <> "" Then
       Text1.Text = Text1.Text & vbNewLine & Dir2.List(i)
      Else
       Text1.Text = Dir2.List(i)
      End If
     Next i
    End Sub
    Any ideas?

    Thanks in advance!

  2. #2
    Megatron
    Guest
    Try this.
    VB Code:
    1. sFile = Dir$("C:\MyDir\*.*")
    2. Do While sFile <> ""
    3.     Print sFile
    4.     sFile = Dir$
    5. Loop

  3. #3
    rsitogp
    Guest
    Excuse my ignorence, but I get a run time error 5 (invalid procudure call or argument) on the
    Code:
    sFile = Dir$
    line.

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Check your code again. It works fine
    Baaaaaaaaah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width