Hello all,

I'm new to the forums and very limited w/ coding experience, so please forgive me if this is a total noob type question. Also, I'm working w/in the image analysis program Image Pro w/ it's built in VisualBasic tools. Not sure if that matters.

My issue: I need to get a list of specific files from a directory into a combo box for the user to then select from. I know how to look through the directory to find the files I want. What I don't know is how to take this list into an array, which can then be used to populate the combo box. Any help, advice, tips and tricks is very welcome. Thank you all so much for yor help.

Here is what I came up w/ to search and get the file names. I know it works when I debug.print the names....but how to get this:

Code:
  
Sub MakeCount_Measure_FileList ()

Dim sDirectory As String
Dim sFilter As String, NFiles%, i%
Dim FileNameCB As String*255

sDirectory="C:\iAM"
sFilter="*.env*"

'Get number of files
NFiles = IpStSortedList(sDirectory,sFilter,SORT_GET_NFILES,IPNULL)
ReDim FileList(NFiles) As Integer
'get list sorted by name
ret=IpStSortedList(sDirectory,sFilter,SORT_BY_NAME_ASC,FileList(0))
'print list

For i=0 To NFiles-1
  'Get file Name
  If IpStSearchDir (sDirectory,sFilter, FileList(i), FileNameCB)=1 Then 'print only files, skip folder names

	Debug.Print i & "  " & FileNameCB
  End If
Next

End Sub
Get that list into this combo box:

Code:
Dim ListArray$()
	ListArray$() = FileNameCB
Begin Dialog UserDialog 820,427,"Select Count/Measure File" ' %GRID:10,7,1,1
		ComboBox 70,49,680,322,FileNameCB,.ComboBox1
		OKButton 350,385,120,28
	End Dialog
	Dim dlg As UserDialog
	Dialog dlg
End