用Directory.CreateDirectory即可創(chuàng)建文件夾:
創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比喀喇沁網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式喀喇沁網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋喀喇沁地區(qū)。費用合理售后完善,十余年實體公司更值得信賴。
'?建立目錄
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)建成功")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim AppPath As String = Directory.GetCurrentDirectory() '獲取應(yīng)用程序的當前工作目錄 Process.Start(AppPath) '打開當前目錄 End Sub
我也找來的,只找到這個,希望對你有幫助。
Dim
dir
As
New
IO.DirectoryInfo("C:\TDDownload")
//
目錄下就一個文件夾
If
dir.GetDirectories.Length
Then
MessageBox.Show(dir.GetDirectories.GetValue(0).ToString())
End
If
//
目錄下多個文件夾
'For
Each
d
As
IO.DirectoryInfo
In
dir.GetDirectories
'
MessageBox.Show(d.FullName)
'Next
OpenFileDialog openFile = new OpenFileDialog();
openFile.Multiselect = true;
openFile.Filter = "圖片 (*.jpg)|*.jpg|所有文件 (*.*)|*.*";
if (openFile.ShowDialog() == DialogResult.OK)
{
string ss = openFile.FileName;
string ww = openFile.FileName.Remove(openFile.FileName.Length - 4, 4);
File.Copy(ss, @"..\..\picture\" + Path.GetFileName(ss));
}
上面是先獲取路徑,在把圖片復制到指定路徑下。
System.Windows.Forms.OpenFileDialog
System.Windows.Forms.SaveFileDialog
System.Windows.Forms.FolderBrowserDialog
以上三個類均能夠很好的解決樓主的需求。
具體的請lz自己查msdn
vb.net使用控件FolderBrowserDialog1,在程序中:
'設(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()中針對你所需要的文件進行操作等
網(wǎng)頁名稱:vb.net當前文件夾 vb讀取文件夾
當前鏈接:http://www.rwnh.cn/article38/hpjspp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營銷推廣、網(wǎng)站內(nèi)鏈、網(wǎng)站導航、外貿(mào)網(wǎng)站建設(shè)、電子商務(wù)、品牌網(wǎng)站設(shè)計
聲明:本網(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)