Need List box to read and display files in C Sharp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Stevens
    New Member
    • Mar 2012
    • 1

    Need List box to read and display files in C Sharp

    Hello.

    I need a list box which will display the contents of a folder with a specific files type in it. For instance, if the folder contains .exe, .txt and .zip files I need it to just display the .txt files. How Would I go about doing this?

    Thanks, Mark
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    First you need to read the contents of the directory.
    Then you can either try binding the ListBox to it, or you can manually loop through the contents and add list items to the list box.

    You use the DirectoryInfo class to do this.

    -Frinny

    Comment

    Working...