使用树视图或列表视图操作文件夹创建和删除。 [英] Manipulating Folder create and delete using Tree view or List view.

查看:147
本文介绍了使用树视图或列表视图操作文件夹创建和删除。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我提前表达了感谢。我是VB .net开发人员。我需要同时在树视图中显示文件夹和文件,我需要使用相同的树视图创建和删除文件夹。谁能帮我。我在网上看过很多项目。但所有只是在树视图中探索文件夹,但我也需要创建并删除文件夹。任何人帮助我.....

Hello every one,
I convey my thanks in advance. I am a VB .net developer. I need to show the folders and files in a Tree view in the mean time, I need to do the create and delete of folders using the same Tree view. Can anyone help me. I have seen lots of projects in the web. But all are just only explore the folders in tree view but i need to create and also delete the folders also. Any one help me.....

推荐答案

看看这里:演练:在Visual Basic中操作文件和目录 [ ^ ]和这里:使用TreeView资源管理器VB.NET 2008 [ ^ ]



这很简单。试试!
Have a look here: Walkthrough: Manipulating Files and Directories in Visual Basic[^] and here: TreeView Explorer using VB.NET 2008[^]

It's pretty straightforward. Try!


除了Maciej Los发布的解决方案之外,你应该查看 System.IO 命名空间,其中包含有关管理文件和目录的所有信息:



http://msdn.microsoft。 com / en-us / library / system.io.aspx [ ^ ]



你应该区分管理数据(例如创建/重命名/删除文件或目录)和呈现TreeView(或任何其他组件)上的数据。您不是通过TreeView组件创建/删除文件或目录。它的目的是仅显示数据。



您可以使用TreeView.Nodes属性访问TreeView控件中的所有元素。然后,您可以获取所选的数据(文件或目录),并使用该信息执行任何操作。如果已选择目录,则可以添加或删除子目录。这完全取决于你。

使用TreeView组件的良好开端在于:

http ://www.dotnetperls.com/treeview [ ^ ]

http: //msdn.microsoft.com/en-us/library/system.windows.forms.treeview%28v=vs.110%29.aspx [ ^ ]



干杯!
In addition to solution posted by Maciej Los, you definitelly should look at System.IO namespace which contain all informations about managing files and directories:

http://msdn.microsoft.com/en-us/library/system.io.aspx[^]

You should distinct between manage data (such as create/rename/delete file or directory) and presenting that data on TreeView (or any other component). You are not creating/deleting files or directories via TreeView component. It's purpose is to present data only.

You can access all elements in TreeView control using TreeView.Nodes property. Then you can get what data is selected (file or directory) and do whatever you want with that information. If you have selected directory then you can add or delete child directories. It's all up to you.
Good start with using TreeView component is here:
http://www.dotnetperls.com/treeview[^]
http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview%28v=vs.110%29.aspx[^]

Cheers!


这篇关于使用树视图或列表视图操作文件夹创建和删除。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆