用Microsoft.VisualBasic.FileIO.Filesystem.GetFiles方法。在文件名参数写"*.jpg"就行了。返回ReadOnlyCollection。记住:READONLYCOLLECTION的Item属性最大值为Count-1不是count
然后用for循环将readonlycollection的项添加到ListBox控件。把邮箱给我,过两天把代码发给你
代码
On Error Resume Next'最好使用VB.NET 的Try catch语句块
dim Loopint1 as integer,tmpstr1,tmpstr3 as string
Dim flist As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
fList=Microsoft.VisualBasic.FileIO.FileSystem.GetFiles(gfPath, FileIO.SearchOption.SearchTopLevelOnly, "*.jpg")
x = flist.Count
For LoopInt1 = 0 To x - 1 '循环控制
tmpstr3 = "" '清空属性字符串
tmpstr1 = flist.Item(LoopInt1)
IntInStr = InStrRev(tmpstr1, "\")
tmpstr2 = Microsoft.VisualBasic.Strings.Right(tmpstr1, Len(tmpstr1) - IntInStr)'只得到文件名,如果要完整路径就要循环里第二行即可
Listbox1.Items.Add(tmpstr2)'添加内容
Next
'其实完全可以制作一个VB6的文件列表框,加上Listview,资源管理器也是可以做的,只不过图标控制比较麻烦而已
'照相时间要获得EXIF信息,这个我不知道,你上网找找看
温馨提示:答案为网友推荐,仅供参考