you could use a datagridview rather than a listbox. i'd still recommend using LINQ in vb2008:
vb Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'this gets all the icons from a folder containing icons 'displaying the filename in the first column in the dgv 'the full path to the icon in the hidden second column '+ the actual icon in the third column Dim files = (From fi As IO.FileInfo In New IO.DirectoryInfo("C:\Users\Paul\Pictures\ICO").GetFiles _ Select New With { _ .filename = fi.Name, .fullName = fi.FullName, .image = Image.FromFile(fi.FullName) _ }).ToList DataGridView1.DataSource = files DataGridView1.Columns(1).Visible = False End Sub End Class




Reply With Quote