Results 1 to 3 of 3

Thread: List files in one folder but got an error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    List files in one folder but got an error

    I use code below to list files in listbox1 but an item "~$0020419.doc" was listing there. I reboot pc but no luck. Why?

    In C:\test\, there are only 3 files: 100020419.doc, 100025818.doc and demo.doc

    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:\test\")
    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

  2. #2

  3. #3
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: List files in one folder but got an error

    its a temp file for when you open an office file which is normally hidden, to see it in explorer you need to adjust your view options to show hidden objects
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

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