K KevG New Member Licensed User Apr 19, 2009 #1 Hi, New to B4PPC and no doubt there's a very simple answer... I want to populate a combo box with a list of files from a given directory, let's say "C:\Files\Data\", the files will have a set file extension, let's say "*.cog". When the file is selected the contents are used within the program; I'm happy with doing that bit. It's the combo box option I'm after and not going down the file explorer route. Any thoughts? Ta very, KevG
Hi, New to B4PPC and no doubt there's a very simple answer... I want to populate a combo box with a list of files from a given directory, let's say "C:\Files\Data\", the files will have a set file extension, let's say "*.cog". When the file is selected the contents are used within the program; I'm happy with doing that bit. It's the combo box option I'm after and not going down the file explorer route. Any thoughts? Ta very, KevG
Erel B4X founder Staff member Licensed User Longtime User Apr 19, 2009 #2 Here: Add a ComboBox named ComboBox1 and an ArrayList named ArrayList1. Code: Copy Sub Globals 'Declare the global variables here. End Sub Sub App_Start Form1.Show FileSearch(ArrayList1, "c:\Files\Data", "*.cog") For i = 0 To ArrayList1.Count - 1 ComboBox1.Add(FileName(ArrayList1.Item(i))) Next End Sub
Here: Add a ComboBox named ComboBox1 and an ArrayList named ArrayList1. Code: Copy Sub Globals 'Declare the global variables here. End Sub Sub App_Start Form1.Show FileSearch(ArrayList1, "c:\Files\Data", "*.cog") For i = 0 To ArrayList1.Count - 1 ComboBox1.Add(FileName(ArrayList1.Item(i))) Next End Sub