可以的,你在窗体上加入一个 filelistbox,一个command,一个text,将filelistbox的pattern属性设为 *.jpg ,代码如下:
Private Sub Command1_Click()
Dim p As String, i As Integer
p = CStr(Text1.Text)
For Index = 0 To File1.ListCount - 1
File1.ListIndex = Index
If InStr(1, CStr(File1.FileName), p) > 0 Then '如果text输入的字能在文件名里找到
Picture1.Picture = LoadPicture(File1.Path & "\" & File1.FileName)
End If
Next
End Sub
Private Sub Form_Load()
File1.Visible = False
File1.Path = "F:\My DBank"
End Sub
使用以上代码,比如你"F:\My DBank" 文件夹下有个01.jpg, 你在text1中输入 "0 "或 "1” 单击command就可以显示01.jpg