New topic: File names into listbox?
<http://forums.realsoftware.com/viewtopic.php?t=47850> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message RicSum Post subject: File names into listbox?Posted: Sat May 11, 2013 10:58 am Joined: Fri Jun 05, 2009 4:54 pm Posts: 468 Location: London, England Hi all, I am trying to get a listbox to display rows populated with the names of all files in a particular folder. I saw a couple of posts (I think one was from Kem Tekinay), and tried to combine them and ended up with the code below. Could someone please tell me if this looks correct and would work. Dim f As FolderItem f=getfolderitem("pathToMyFolder") Dim filetype() As String filetype = Array(".txt",".rtf") Dim fileext As String Dim i As Integer dim fileList() as FolderItem dim folderCount as integer = f.Count for i = 1 to folderCount fileList.Append f.Item( i ) next for i = 0 to fileList.Ubound dim thisFile as FolderItem = fileList( i ) dim thisName as string = thisFile.Name For Each fileext In filetype dim thisExt as string = thisName.Right( fileext.Len ) if thisExt = fileext then ListBox1.AddRow thisName end if next next Thank you all in advance. _________________ RealStudio Professional Edition 2012 r2 Developing on OS X 10.8 (Mountain Lion) Deploying on Windows XP / Vista / 7 / 8 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
