自行调试
Dim dics As New SortedDictionary(Of String, String)
For Each dl As String In dls
msgbox(dl)
Dim Parts() As String = dl.Split("*")
msgbox(Parts(1))
dics.Add(Parts(1) & dl, dl)
Next
Dim arr(dics.keys.count - 1) As String
dics.keys.copyto(arr, 0)
For i As Integer = arr.length - 1 To 0 Step - 1
msgbox(“i=” & i)
Dim dl As String = dics(arr(i))
msgbox(“dl=” & dl)
Dim Parts() As String = dl.Split("*")
msgbox(“parts(0)=” & parts(0))
Dim r As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
Dim Dot As Integer = parts(0).LastIndexOf(".") '定义.的位置
Dim kzm As String = parts(0).SubString(Dot + 1) '获取扩展名
msgbox(“kzm=” & kzm)
If kzms.Contains(kzm) = True Then '若为已知扩展名
r.ImageKey = kzm '指定行的图标键值
Else
r.ImageKey = "other"
End If
r("序号") = i + 1
r("文件名称") = Parts(0)