用Directory.CreateDirectory即可創(chuàng)建文件夾:

創(chuàng)新互聯(lián),專注為中小企業(yè)提供官網(wǎng)建設(shè)、營(yíng)銷型網(wǎng)站制作、響應(yīng)式網(wǎng)站、展示型做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)等服務(wù),幫助中小企業(yè)通過(guò)網(wǎng)站體現(xiàn)價(jià)值、有效益。幫助企業(yè)快速建站、解決網(wǎng)站建設(shè)與網(wǎng)站營(yíng)銷推廣問(wèn)題。
'?建立目錄
If?Not?Directory.Exists("C:\負(fù)屃\"??TextBox1.Text)?Then?'檢查文件夾是否存在
Directory.CreateDirectory("C:\負(fù)屃\"??TextBox1.Text)??'不存在,創(chuàng)建文件建夾
End?If
你的例子是因?yàn)樯倭艘粋€(gè)"\"引起的,正確的如下:
Dim?fsotest?As?New?FileSystemObject
If?fsotest.FileExists("C:\負(fù)屃\"??TextBox1.Text)?=?False?Then
fsotest.CreateFolder("C:\負(fù)屃\"??TextBox1.Text) '這里你少了一個(gè)\
End?If
MsgBox("創(chuàng)建成功")
vb.net使用控件folderbrowserdialog1,在程序中:
'設(shè)置對(duì)話框中在樹視圖控件上顯示的說(shuō)明文本
me.folderbrowserdialog1.description
=
"請(qǐng)選擇輸出報(bào)表所在路徑:"
'設(shè)置從其開始瀏覽的根文件夾
me.folderbrowserdialog1.selectedpath
=
"c:\"
if
me.folderbrowserdialog1.showdialog()
=
dialogresult.ok
then
'取得全路徑(包含文件名)
reportpath1
=
system.io.path.getfullpath(me.folderbrowserdialog1.selectedpath)
'設(shè)定text顯示文件名
txtreport1.text
=
reportpath1
setreportlist()
end
if
在setreportlist()中針對(duì)你所需要的文件進(jìn)行操作等
舉個(gè)例子:
先引入命名空間:
Imports
System.IOImports
System.Security.AccessControl
代碼:
Dim
sec
As
DirectorySecurity
=
New
DirectorySecurityDim
rule
As
FileSystemAccessRule
=
New
FileSystemAccessRule("Administrator",
FileSystemRights.Delete,
AccessControlType.Allow)sec.AddAccessRule(rule)Directory.CreateDirectory("C:\test",
sec)
這段代碼就是以
Administrator
帳戶
在
C:\
創(chuàng)建
test
文件夾。
網(wǎng)站題目:vb.net文件創(chuàng)建 vb net
本文鏈接:http://chinadenli.net/article8/ddochop.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、營(yíng)銷型網(wǎng)站建設(shè)、動(dòng)態(tài)網(wǎng)站、網(wǎng)站策劃、外貿(mào)建站、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)