Hello,
I have a picture box and a list box on my form.

I am using this code to put the names of all the files in a list box.

VB Code:
  1. Dim fso As New Scripting.FileSystemObject
  2. Dim xFolder As Folder
  3. Dim xFile As File
  4.  
  5. Set xFolder = fso.GetFolder("C:\Pictures")
  6. For Each xFile In xFolder.Files
  7.     List1.AddItem xFile.Name
  8. Next

Now what I need to do is get it to get the "checkboxed" item in the list and open that file in the pic box.

I have this code below:

VB Code:
  1. Dim I As Long
  2. Dim xStr As String
  3.  
  4. For I = List1.ListCount - 1 To 0 Step -1
  5.     If List1.Selected(I) Then
  6.     Open "C:\Pictures" & Form1.List1.List(I) For Binary As #1
  7.         xStr = Space(LOF(1))
  8.         Get #1, , xStr
  9.         Picture1.Picture = xStr
  10.         Close #1
  11.         Exit For
  12.    
  13. End If
  14. Next

But I get Object required error on xStr in this line " Picture1.Picture = xStr"

Does anyone know how I can fix this?

Thank you!
Stilekid007