Can you help me to display icon view from the files i get from a directory
Here is my code.
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
SearchDir("g:\")
End Sub
Public Sub SearchDir(ByVal sDir As String)
Dim fil As String
Try
For Each dir As String In Directory.GetDirectories(sDir)
For Each fil In Directory.GetFiles(dir, " *.doc ")
ListView1.Items.Add(fil)
Next
SearchDir(dir)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
this gives me a result, but in form of string displaying its path
First of all, you need to add ImageList
tool from Visual Studio Toolbox. Then select its properties and select the images you need to work with.
After that, you need to use the corresponding given serial-wise IDs by ImageList
in your ListView
code as follows:
Declaration:
Private lView As ListViewItem ' listView's lView (not I-view)
lView = ListView1.Items.Add("Special iconic thing", 0) ' 0 = my icon ID in ImageList
You should get the similar to my output:
Hope it works for you.