VB编程:请教如何编写搜索语句?

来源:百度知道 编辑:UC知道 时间:2024/05/13 20:04:30
我想编写一个程序,用于搜索硬盘中的某个文件,怎么编写?
请懂些VB的高手或菜鸟们帮个忙,多谢啦!
梦想种子:程序运行了,我输入了某个文件名,但在C盘没有发现result2.txt文件?

靠 楼上的枪手 老子碰你好多次了
这个用遍历的算法做,这是我一个程序上面的,我只是截取下来的,可能还要做些兼容的工作

On Error GoTo Err:

Dim PathIndex(256) As Integer
Dim PIIndex As Integer

Dir.Path = "C:\"
PIIndex = 1
For b = 1 To 255
PathIndex(b) = 0
Next b

Returns:
SearchingNow.Caption = AddL(Dir.Path, "\")
If Paused Then
SearchingNow.Caption = ""
Exit Sub
End If
SearchDir
DoEvents

Reback:
If PathIndex(PIIndex) <= Dir.ListCount - 1 Then
Dir.Path = Dir.List(PathIndex(PIIndex))
PIIndex = PIIndex + 1
PathIndex(PIIndex) = 0
GoTo Returns
Else
If Dir.Path <> GoBack(Dir.Path) Then
Dir.Path = GoBack(Dir.Path)
PIIndex = PIIndex - 1
PathIndex(PIIndex) = PathIndex(PIIndex) + 1
If PathIndex(PIIndex) > Dir.ListCount - 1 Then GoTo Reback
Dir.Path