The code below is to upload a list of folders and files within a folder on my PC to a listbox named lstfiles.
Can anyone tell me why the file list does not appear in the selected folder view but does upload filenames to a listbox and how I can make filenames appear in the selected folder view and only upload the files I highlight.
// Event Handler: btnUploadFiles.Pressed
Var dlg As FolderItem
dlg = SelectFolder() // Opens a folder selection dialog
If dlg <> Nil And dlg.Directory Then
lstFiles.RemoveAllRows() // Clear the ListBox
// Iterate through the folder’s contents
For Each currentItem As FolderItem In dlg.Children
If currentItem <> Nil Then
If Not currentItem.Directory Then
lstFiles.AddRow(currentItem.Name) // Add only files
ElseIf currentItem.Directory Then
lstFiles.AddRow(currentItem.Name + “/”) // Add subdirectories
End If
End If
Next
Else
MessageBox(“No folder selected or the selection is not a folder.”)
End If
11 posts - 3 participants