Get a list of all files inside of a directory in vb.net

谁都会走 提交于 2019-11-27 08:43:55

It looks like you want to use Directory.GetFiles() in the System.IO namespace.

Docs here.

sansalk
    Dim txtFiles = Directory.GetFiles("C:\Input", "*.CSV", SearchOption.TopDirectoryOnly).
        [Select](Function(nm) Path.GetFileName(nm))

    Dim arrayList As New System.Collections.ArrayList()
    For Each filenm As String In txtFiles
        arrayList.Add(New clsImportFiles(filenm))
    Next

Add a Listbox to Windows Form and Add following code on Form Load or other events :-

ListBox1.Items.AddRange(Directory.GetFiles("Your Directory PAth Here"))

Hope IT Helps ; From Nirav

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!