很急!希望各位帮忙!!
我想在texbox控件中输入一个文件名,单击提交后,能够遍历指定文件夹下对应的文件,同时把该文件的完全路径赋给xmlread()
[此贴子已经被作者于2006-8-13 14:26:49编辑过]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (TextBox1.Text <> "") Then
If System.IO.Directory.Exists(TextBox1.Text) Then
Dim theDir As New System.IO.DirectoryInfo(TextBox1.Text)
FindFiles(theDir)
End If
Else
MessageBox.Show("请输入目录")
End If
End Sub
Private Sub FindFiles(ByVal myDir As System.IO.DirectoryInfo)
Dim files As System.IO.FileInfo()
files = myDir.GetFiles()
Dim fi As System.IO.FileInfo
For Each fi In files
Dim ListItem As New ListViewItem(fi.Name)
ListItem.SubItems.Add(fi.Length.ToString())
ListItem.SubItems.Add(fi.DirectoryName)
ListView1.Items.Add(ListItem)
Next
Dim myDirs As System.IO.DirectoryInfo()
myDirs = myDir.GetDirectories()
Dim Dir As System.IO.DirectoryInfo
For Each Dir In myDirs
FindFiles(Dir)
Next
End Sub