本文介绍了如何在C#中将目录中的文件夹和子文件夹列出到Treeview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好, 我想用驱动器中所有文件夹和子文件夹的列表填充treeview 我有一个Windows窗体,上面有一个树状视图.我想用目录中的所有文件夹和子文件夹填充它.我为此搜索了Google,但没有得到任何好的资源,对此有什么帮助吗? 假设我选择D:\,则树视图将加载D:\ 中的所有文件夹和子文件夹 任何帮助将是thankfull
Hi all, I want to populate a treeview with the list of all folders and subfolders from a Drive I have a Windows form having a tree view on it. I want to populate it with all folders and subfolders from a Directory. I googled for this, and didnt get any good source, could any one help on this? Say if i select D:\ , then the treeview loads with all folders and subfolders in D:\ Any help will be thankfull
推荐答案集中在一个节点上.它应该代表一条路径.使用 GetDirectories [ ^ ]方法.为每个子目录创建一个子节点.如果用户展开子节点之一,请重复此操作. Concentrate on one node. It should represent a path. Get all its subdirectories using the GetDirectories[^] method. Create a child node for every subdirectory. Repeat if user expands one of the child nodes.
请参考以下链接. social.msdn.microsoft/论坛/en-US/csharpgeneral/thread/1c89fa5d-1dd1-4f11-aeca-8ba157d673bf [ ^ ] 列出文件夹和子文件夹 [ ^ ] Hi, Please refer the below link for the same. social.msdn.microsoft/Forums/en-US/csharpgeneral/thread/1c89fa5d-1dd1-4f11-aeca-8ba157d673bf[^] Listing Folder and SubFolder[^]
更多推荐
如何在C#.net中将目录中的文件夹和子文件夹列出到Treeview
发布评论