vb.net新建目录,vb 新建文件夹

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

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

创新互联长期为上千客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为乌拉特前企业提供专业的成都做网站、网站建设,乌拉特前网站改版等技术服务。拥有十多年丰富建站经验和众多成功案例,为您定制开发。

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 注册表 新建目录树

Dim Reg As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser 'HKEY_CURRENT_USER

Reg.OpenSubKey("\1\2\3\4\5\6\7", True) '在HKEY_CURRENT_USER下新建1\2\3\4\5\6\7的项

希望能对你有所启发和帮助。

VB.NET 创建文件夹

用Directory.CreateDirectory即可创建文件夹:

' 建立目录

If Not Directory.Exists("C:\负屃\"  TextBox1.Text) Then '检查文件夹是否存在

Directory.CreateDirectory("C:\负屃\"  TextBox1.Text)  '不存在,创建文件建夹

End If

你的例子是因为少了一个"\"引起的,正确的如下:

Dim fsotest As New FileSystemObject

If fsotest.FileExists("C:\负屃\"  TextBox1.Text) = False Then

fsotest.CreateFolder("C:\负屃\"  TextBox1.Text) '这里你少了一个\

End If

MsgBox("创建成功")

怎么利用vb.net创建文件夹

'vb.net2008

Imports System.IO

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim b_path As String

b_path = "d:\123"

If Directory.Exists(b_path) = True Then

MsgBox("已有 " b_path " 目录")

Else

Directory.CreateDirectory(b_path)

MsgBox("新创建 " b_path " 目录")

End If

End Sub

End Class


网页标题:vb.net新建目录,vb 新建文件夹
文章路径:http://lszwz.com/article/dssoope.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款