ListView Icons

flann

Member
Joined
Jun 8, 2005
Messages
20
Programming Experience
Beginner
I'm trying to create a listview that will display files from a directory and show them as icons.

Dim s As String
ListView1.Clear()

Dim strFiles As String() = Directory.GetFiles(TreeView1.SelectedNode.Text)
For Each s In strFiles
ListView1.Items.Add(s)
ListView1.View = View.SmallIcon
Next


What else do I need to do to make it actually display an icon? It does display the file name, but it is in text, not an icon.
 
I got my Icon to show up, but I can't seem to figure out how to get the pdf file to open?

VB.NET:
		Dim s As String
		Dim imageListLarge As New ImageList
		ListView1.Clear()
		imageListLarge.Images.Add(Bitmap.FromFile("c:\PDFFile.ico"))
		ListView1.LargeImageList = imageListLarge

		Dim strFiles As String() = Directory.GetFiles(TreeView1.SelectedNode.Text)
		For Each s In strFiles
			ListView1.Items.Add(s).ImageIndex = 0
			ListView1.View = View.LargeIcon
			ListView1.LabelEdit = True
		Next
 
Back
Top