冒险解谜游戏中文网 ChinaAVG
标题: VB.net中遍历所有目录和文件 [打印本页]
作者: shane007 时间: 2010-6-10 11:46
标题: VB.net中遍历所有目录和文件
原文; z5 S# D) \2 G) f- ]3 D' l- }$ Z+ y
http://hi.baidu.com/chen_bawang/blog/item/598229385e1d6d26b8998fde.html
# m1 q+ J. e$ p% M# X& v9 E% [7 u+ l2 L1 E* O: W
我的环境是VB.Net2005
' d" l3 d5 W# n; fPublic Class Form1
Private FilePath As String = "D:\程序\代码收藏"
Private vbFilePath As String = "D:\程序\代码收藏\VB"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TransFiles(vbFilePath)
End Sub
Private Sub TransFiles(ByVal strDirect As String)
If Not (strDirect Is Nothing) Then
Debug.Print("**********************************")
Debug.Print(strDirect)
Dim mFileInfo As System.IO.FileInfo
Dim mDir As System.IO.DirectoryInfo
Dim mDirInfo As New System.IO.DirectoryInfo(strDirect)
For Each mFileInfo In mDirInfo.GetFiles()
Debug.Print(mFileInfo.FullName) '你可以修改代码添加到你的数组中
Next
For Each mDir In mDirInfo.GetDirectories
TransFiles(mDir.FullName)
Next
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TransFiles(vbFilePath)
End Sub
End Class
作者: shane007 时间: 2010-6-20 09:40
顶上来备用
作者: shane007 时间: 2011-3-6 13:51
顶上来备用2
作者: shane007 时间: 2011-3-27 15:12
顶上来备用3
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/) |
Powered by Discuz! X3.2 |