资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net文件夹管理 vb的文件管理控件是

vb.net 创建文件夹和删除文件夹

Private Sub btnRemovePath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemovePath.Click

成都创新互联专注于冷水江网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供冷水江营销型网站建设,冷水江网站制作、冷水江网页设计、冷水江网站官网定制、小程序制作服务,打造冷水江网络公司原创品牌,更为您提供冷水江网站排名全网营销落地服务。

Try

' 先建立目录以便用于后续的删除示范。

If Not Directory.Exists("D:\网易") Then

Directory.CreateDirectory(" D:\网易 \Test1")

Directory.CreateDirectory(" D:\网易 \Test2")

Directory.CreateDirectory(" D:\网易 \Test3")

End If

' 删除子目录 Test1。

Directory.Delete(" D:\网易 \Test1", True)

' 删除子目录 Test2。

Dim myDirectoryInfo As New DirectoryInfo(" D:\网易 \Test2")

myDirectoryInfo.Delete(True)

' 将目录 C:\AlexDirDemo 及其以下的文件和子目录全数删除。

Directory.Delete(" D:\网易 ", True)

Catch ex As Exception

MessageBox.Show(ex.Message)

Exit Sub

End Try

' 启动 Windows 资源管理器。

Process.Start("explorer.exe", "D:\")

End Sub

vb.net 文件夹操作

vb.net使用控件FolderBrowserDialog1,在程序中:

'设置对话框中在树视图控件上显示的说明文本

Me.FolderBrowserDialog1.Description = "请选择输出报表所在路径:"

'设置从其开始浏览的根文件夹

Me.FolderBrowserDialog1.SelectedPath = "c:\"

If Me.FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then

'取得全路径(包含文件名)

reportPath1 = System.IO.Path.GetFullPath(Me.FolderBrowserDialog1.SelectedPath)

'设定text显示文件名

txtReport1.Text = reportPath1

setReportList()

End If

在setReportList()中针对你所需要的文件进行操作等

vb.net 操作文件夹用户权限

'

' 需要添加以下命名空间:

' Imports System.IO

' Imports System.Security.AccessControl

' */

Dim sPath As String = Server.MapPath(文件夹名称字符串)

Directory.CreateDirectory(sPath)

addpathPower(sPath, "ASPNET", "FullControl")

'////////////////////////////////////////////////

Public Sub addpathPower(ByVal pathname As String, ByVal username As String, ByVal power As String)

Dim dirinfo As DirectoryInfo = New DirectoryInfo(pathname)

If (dirinfo.Attributes FileAttributes.ReadOnly) 0 Then

dirinfo.Attributes = FileAttributes.Normal

End If

'取得访问控制列表

Dim dirsecurity As DirectorySecurity = dirinfo.GetAccessControl()

Select Case power

Case "FullControl"

dirsecurity.AddAccessRule(New FileSystemAccessRule(uername,FileSystemRights.FullControl,InheritanceFlags.ContainerInherit,PropagationFlags.InheritOnly,AccessControlType.Allow))

Exit Sub

Case "ReadOnly"

dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Read,AccessControlType.Allow))

Exit Sub

Case "Write"

dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Write,AccessControlType.Allow))

Exit Sub

Case "Modify"

dirsecurity.AddAccessRule(New FileSystemAccessRule(username,FileSystemRights.Modify,AccessControlType.Allow))

Exit Sub

End Select

dirinfo.SetAccessControl(dirsecurity)

End Sub

vb.net如何查看文件夹的权限

vb.net查看文件夹权限方法:

1、右键单击获取权限的文件夹,转到安全Tab。

2、显示了这个文件夹的权限账户。

3、输入对应账户的名称与密码即可查看全部权限信息。


网页标题:vb.net文件夹管理 vb的文件管理控件是
分享路径:http://cdkjz.cn/article/dogegsc.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220