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:
Dim fso As New Scripting.FileSystemObject Dim xFolder As Folder Dim xFile As File Set xFolder = fso.GetFolder("C:\Pictures") For Each xFile In xFolder.Files List1.AddItem xFile.Name 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:
Dim I As Long Dim xStr As String For I = List1.ListCount - 1 To 0 Step -1 If List1.Selected(I) Then Open "C:\Pictures" & Form1.List1.List(I) For Binary As #1 xStr = Space(LOF(1)) Get #1, , xStr Picture1.Picture = xStr Close #1 Exit For End If 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




Reply With Quote