Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to get the file names in a directory

How to get the file names in a directory

Scheduled Pinned Locked Moved Visual Basic
csharptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SekharOne
    wrote on last edited by
    #1

    I have an application in which i need to search for the files in a directory and list them in a listbox. Could any body tell how to do this using vb.net 2005. I am new to vb.net. Thanks in Advance.

    R 1 Reply Last reply
    0
    • S SekharOne

      I have an application in which i need to search for the files in a directory and list them in a listbox. Could any body tell how to do this using vb.net 2005. I am new to vb.net. Thanks in Advance.

      R Offline
      R Offline
      Rupesh Kumar Swami
      wrote on last edited by
      #2

      hi, use following statements for get files from particular directory If Directory.Exists(Application.StartupPath & "\ABC") Then Dim ob As New DirectoryInfo(Application.StartupPath & "\ABC") Dim file_infos() As FileInfo file_infos = ob.GetFiles() For Each file_info As FileInfo In file_infos Listbox1.Items.Add(file_info.FullName) Next file_info End If hope this helps

      Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11

      S 1 Reply Last reply
      0
      • R Rupesh Kumar Swami

        hi, use following statements for get files from particular directory If Directory.Exists(Application.StartupPath & "\ABC") Then Dim ob As New DirectoryInfo(Application.StartupPath & "\ABC") Dim file_infos() As FileInfo file_infos = ob.GetFiles() For Each file_info As FileInfo In file_infos Listbox1.Items.Add(file_info.FullName) Next file_info End If hope this helps

        Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11

        S Offline
        S Offline
        SekharOne
        wrote on last edited by
        #3

        Thanks Rupesh for your reply. It realy helped. Thanks once again.

        Sekhar :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups