- Jun 13, 2013
- Programming Experience
Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeView1.AfterSelect ListView1.Items.Clear() For Each Thing As String In Directory.GetFiles(e.Node.Tag) Dim fi As FileInfo = New FileInfo(Thing) With ListView1.Items.Add(fi.Name) .ImageIndex = 0 .Tag = fi.FullName End With Next For Each LVI As ListViewItem In ListView1.Items Dim shellFile__1 As ShellFile = ShellFile.FromFilePath(LVI.Tag) Dim shellThumb As Bitmap = shellFile__1.Thumbnail.ExtraLargeBitmap ImageList2.Images.Add(shellThumb) LVI.ImageIndex = ImageList2.Images.Count - 1 Next End Sub
I need to put that second For loop into its own thread, it's loading thumbnails. I've gone through some tutorials to do multithreading and crossthreading but I don't understand how I would enqueue things like "For Each LVI As ListViewItem In ListView1.Items" let alone the whole loop. How would I put that part in its own thread?
Thanks very much.