Results 1 to 3 of 3

Thread: Setting the io.fileinfo to include the path? *[Resolved]*

  1. #1

    Thread Starter
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203

    Question Setting the io.fileinfo to include the path? *[Resolved]*

    I have this code:

    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            ' make a reference to a directory
            Dim di As New IO.DirectoryInfo("c:\")
            Dim diar1 As IO.FileInfo() = di.GetFiles()
            Dim dra As IO.FileInfo
    
            'list the names of all files in the specified directory
            For Each dra In diar1
                ListBox1.Items.Add(dra)
            Next
        End Sub
    If the program finds something like "Test.txt" then it will return test.txt.
    I want it so that It will return "C:\test.txt".
    (So that it includs the path)
    Last edited by ProgrammerJon; Feb 12th, 2003 at 11:04 AM.

  2. #2
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         ' make a reference to a directory
    3.         Dim di As New IO.DirectoryInfo("c:\")
    4.         Dim diar1 As IO.FileInfo() = di.GetFiles()
    5.         Dim dra As IO.FileInfo
    6.  
    7.  
    8.  
    9.         'list the names of all files in the specified directory
    10.         For Each dra In diar1
    11.             ListBox1.Items.Add(dra.FullName)
    12.         Next
    13.     End Sub

    That will do it
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  3. #3

    Thread Starter
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203
    Thanks

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