jking1234
asked on
Select from Listbox in Access 2007
I load my listbox with the following code:
Private Sub Form_Load()
Dim fso As New IWshRuntimeLibrary.FileSys temObject
Dim fld As Folder
Dim fil As File
Me.lstFiles.RowSource = ""
Set fld = fso.GetFolder(gstrMediaFol der)
For Each fil In fld.Files
Me.lstFiles.AddItem fil.Name
Next fil
End Sub
The listbox is filled with the names of the files in the folder but I cannot select an item and listindex appears to be stuck at -1
Private Sub Form_Load()
Dim fso As New IWshRuntimeLibrary.FileSys
Dim fld As Folder
Dim fil As File
Me.lstFiles.RowSource = ""
Set fld = fso.GetFolder(gstrMediaFol
For Each fil In fld.Files
Me.lstFiles.AddItem fil.Name
Next fil
End Sub
The listbox is filled with the names of the files in the folder but I cannot select an item and listindex appears to be stuck at -1
ASKER
Yes that has been done
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Which was it?
;-)
;-)
Cheers, Andrew