Imports System.IO Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Dir As New DirectoryInfo("C:\Program Files (x86)\AutoHotkey") FillListView(Dir) End Sub Private Sub FillListView(ByVal Folder As DirectoryInfo) Static ImageList As New ImageList With {.ColorDepth = ColorDepth.Depth32Bit, .ImageSize = New Size(22, 22)} Static ImgIndex As Integer = 0 ListView1.LargeImageList = ImageList ListView1.View = View.Tile For Each F As FileInfo In Folder.GetFiles("*.exe") ImageList.Images.Add(Drawing.Icon.ExtractAssociatedIcon(F.FullName)) ListView1.Items.Add(F.Name, ImgIndex).Tag = F ImgIndex += 1 Next For Each F As FileInfo In Folder.GetFiles("*.txt") ImageList.Images.Add(Drawing.Icon.ExtractAssociatedIcon(F.FullName)) ListView1.Items.Add(F.Name, ImgIndex).Tag = F ImgIndex += 1 Next For Each F As FileInfo In Folder.GetFiles("*.hta") ImageList.Images.Add(Drawing.Icon.ExtractAssociatedIcon(F.FullName)) ListView1.Items.Add(F.Name, ImgIndex).Tag = F ImgIndex += 1 Next For Each F As FileInfo In Folder.GetFiles("*.vbs") ImageList.Images.Add(Drawing.Icon.ExtractAssociatedIcon(F.FullName)) ListView1.Items.Add(F.Name, ImgIndex).Tag = F ImgIndex += 1 Next For Each Dir As DirectoryInfo In Folder.GetDirectories FillListView(Dir) Next End Sub End Class
fname= Listview1.SelectedItems(0).Text
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)