|
-
Feb 7th, 2008, 05:27 PM
#1
Thread Starter
Lively Member
File list
I'm gathering the selected files from a folder into a ListBox, everything is fine as long as I select the files by mouse, but if I use shift+mouse to select multiple rows of files, the last one goes first on the list. Any idea how to correct this would be appreciated.
Code:
Private Sub cmdBrowse_Click()
Dim sArr() As String
Dim i As Long
comBrowse.Flags = cdlOFNAllowMultiselect + cdlOFNExplorer
comBrowse.ShowOpen
sArr = Split(comBrowse.Filename, Chr(0))
For i = 0 To UBound(sArr())
lstFiles.AddItem sArr(i)
lstPath.AddItem lstFiles.List(0) & "\" & sArr(i)
Next i
lstFiles.RemoveItem 0
lstPath.RemoveItem 0
End Sub 'cmdBrowse_Click()
There are 2 ListBoxes, one with just filenames (lstFiles) the other with path+file names (lstPath).
-
Feb 7th, 2008, 09:14 PM
#2
Re: File list
try
vb Code:
For i = 0 To UBound(sArr()) lstFiles.AddItem sArr(i) lstPath.AddItem lstFiles.List(i) & "\" & sArr(i) Next i
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|