且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用vb.net创建文件夹

更新时间:2022-10-25 08:23:39

嗨亲爱的,

使用以下内容。 />


  Imports  System.IO 





  dim 路径 as  字符串 =   D:\ Mahesh 
IF Directory.Exists(路径)然后
Directory.CreateDirectory(路径)
结束 IF


 如果  Directory.Exists(folder_name)然后 

Directory.CreateDirectory(folder_name)

结束 如果


你有 Directory.CreateDirectory [ ^ ]方法这会为你做这件事。您当然需要对根文件夹的写权限才能使其正常工作。



作为替代方案,如果您想使用互操作,请通过以高级方式创建文件夹[VB.Net代码] [ ^ ]。

i want to get code in vb.net to create folder on computer

hi dear,
use below.

Imports System.IO



dim path as String = "D:\Mahesh"
IF Not Directory.Exists(path) then
Directory.CreateDirectory(path)
End IF


If Not Directory.Exists(folder_name) Then

            Directory.CreateDirectory(folder_name)

        End If


You have the Directory.CreateDirectory[^] method that will do this for you. You will of course need write permissions on the root folder for this to work correctly.

As an alternative, if you want to use interop, go through Creating a folder the advanced way [VB.Net Code][^].