I am making File Browser software and I want to display icons of my files in listview. Here is the code:
ImageList1.Images.Clear() Dim di As New IO.DirectoryInfo(LocationA.Text) Dim aryFi As IO.FileInfo() = di.GetFiles("*") Dim fi As IO.FileInfo For Each fi In aryFi For Each files In System.IO.Directory.GetFiles(LocationA.Text) Dim icons As Icon = Icon.ExtractAssociatedIcon(files) ImageList1.Images.Add(icons) Next ListView1.Items.Add(fi.Name, ImageList1.Images.Count) Next
This code looks good but when I start the software I see this:
Look at the left listview. First icon in listview loops to end.
Can anyone fix this code?
P.S. LocationA is Label with location of the directory!
Edited 4 Years Ago by LD Company