1. Larry Langford
  2. PowerBuilder
  3. Thursday, 6 September 2018 21:37 PM UTC

How do I access the contents of the individual file names populated in a ListBox by DirList - without user interaction?  I know I can use DirSelection to see the file name clicked on from within the choices of the ListBox, but I need to process each file within a folder systematically.  When I load the list, the properties of the ListBox shows zero items.

Larry Langford Accepted Answer Pending Moderation
  1. Thursday, 6 September 2018 22:07 PM UTC
  2. PowerBuilder
  3. # 1

Perfect Olan!  Thanks so much for your help.....

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 6 September 2018 21:59 PM UTC
  2. PowerBuilder
  3. # 2

Here's some code I've used:

             // Populate the list of files that are in the selected folder
            //        File types to read = 0 (read/write files) + 1 (read files) + 32 (archive/modified files)
            lb_valid = lb_files.DirList (ls_path_ext, 39)
            IF (lb_valid) THEN
                
                ll_count = lb_files.Totalitems ()
                IF (ll_count > 0) THEN
        
                    // Get the list of filenames in the folder
                    FOR ll_index = 1 TO ll_count
                        ll_rc = lb_files.Selectitem (ll_index)
                        
                        lb_valid = lb_files.DirSelect(ls_file1)
                        IF (NOT (lb_valid)) THEN
                            ls_filelist [ll_index] = ls_file1
                        END IF
                    NEXT
                    
                    // Add the list of files into the appropriate structure
                    lstr_file.aur_filenamearray = ls_filelist
                    
                    // Save the path and files selected
                    il_multiple_aur_idx ++
                    istr_aurfiles.aur_pathnames [il_multiple_aur_idx] = is_pathname
                    istr_aurfiles.aur_filenames [il_multiple_aur_idx] = lstr_file                     
                        
                ELSE                    
                    MessageBox ("No Files Found", "There are no read/write files in the selected folder ~"" + &
                                                            is_pathname + "~".", Exclamation!)                    
                END IF        // END IF of are there any read/write files in the selected folder
                
            ELSE
                MessageBox ("File Read Error", "Unable to read the files from the selected folder ~"" + &
                                                        is_pathname + "~".", Exclamation!)
            END IF            // END IF of populate the listbox with DIRLIST
   

Have Fun,

Olan

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.