Populate a TreeView with a string directory

后端 未结 3 1090
一向
一向 2021-01-18 06:14

How to I populate a TreeView with a directory as a string. I am using the FolderBrowserDialog to select a folder and the SelectedPath property to get the string path (i.e. C

3条回答
  •  失恋的感觉
    2021-01-18 07:02

    Add the directory node to the treeview. Set the nodes name to the full path and text to the directory name.

    Recursively add nodes to treeview. Use the System.IO DirectoryInfo and FileInfo collections to get the files and directories in each DirectoryInfo object. make the terminating condition of your recursive function the case where there are no child directories.

提交回复
热议问题