vb.net使用控件folderbrowserdialog1,在程序中:
創(chuàng)新互聯(lián)公司自2013年起,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站設(shè)計、做網(wǎng)站網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元臨汾做網(wǎng)站,已為上家服務(wù),為臨汾各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108
'設(shè)置對話框中在樹視圖控件上顯示的說明文本
me.folderbrowserdialog1.description
=
"請選擇輸出報表所在路徑:"
'設(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()中針對你所需要的文件進行操作等
舉個例子:
先引入命名空間:
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
文件夾。
用Directory.CreateDirectory即可創(chuàng)建文件夾:
'?建立目錄
If?Not?Directory.Exists("C:\負屃\"??TextBox1.Text)?Then?'檢查文件夾是否存在
Directory.CreateDirectory("C:\負屃\"??TextBox1.Text)??'不存在,創(chuàng)建文件建夾
End?If
你的例子是因為少了一個"\"引起的,正確的如下:
Dim?fsotest?As?New?FileSystemObject
If?fsotest.FileExists("C:\負屃\"??TextBox1.Text)?=?False?Then
fsotest.CreateFolder("C:\負屃\"??TextBox1.Text) '這里你少了一個\
End?If
MsgBox("創(chuàng)建成功")
網(wǎng)頁名稱:vb.net中創(chuàng)建文件 vbnet createobject
本文來源:http://www.yijiale78.com/article44/ddosdee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)站策劃、服務(wù)器托管、商城網(wǎng)站、網(wǎng)站維護、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)