以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  怎样查找文件  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=107897)

--  作者:peibaomin
--  发布时间:2017/10/12 10:05:00
--  怎样查找文件
怎样查找指定文件夹下有无要查找的文件名呢如果有就选中该文件呢
--  作者:有点蓝
--  发布时间:2017/10/12 11:08:00
--  
参考:http://www.foxtable.com/webhelp/scr/0331.htm
--  作者:peibaomin
--  发布时间:2017/10/12 11:57:00
--  
If FileSys.FileExists("c:\\fox.jpg") Then
    Messagebox.Show("文件已经存在!","提示")
Else
    Messagebox.Show("文件不存在或已经被删除!","提示")
End If
如果存在的话怎么将鼠标移到该文件上选中他呢?

--  作者:有点甜
--  发布时间:2017/10/12 12:18:00
--  
Dim file As String = "d:\\test.jpg"
If FileSys.FileExists(file) Then
    Messagebox.Show("文件已经存在!","提示")
    System.Diagnostics.Process.Start("Explorer", "  /select," & file & " ")
Else
    Messagebox.Show("文件不存在或已经被删除!","提示")
End If

--  作者:裴保民
--  发布时间:2017/10/13 12:09:00
--  
查找的文件不带路径和文件格式怎么查呢?
[此贴子已经被作者于2017/10/13 12:09:20编辑过]

--  作者:有点甜
--  发布时间:2017/10/13 12:17:00
--  

Dim str As String = "test"
Dim path As String = "d:\\"
Dim f As String = ""
For Each file As String In FileSys.GetFiles(path)
    If FileSys.GetName(file).StartsWith(str) Then
        f = file
        Exit For
    End If
Next
If f > "" Then
    Messagebox.Show("文件已经存在!","提示")
    System.Diagnostics.Process.Start("Explorer", "  /select," & f & " ")
Else
    Messagebox.Show("文件不存在或已经被删除!","提示")
End If