OK I have gotten this far with a list box and am stuck again. Not sure how to apply the selected file to LOADFILE(). It also has a error I cannot figure out when you select the file

?
'Gcode Selection Box
Sub GcodeSelect
Dim MyList()
Begin Dialog BitmapDlg 60, 60, 190, 220, "Gcode file selection", .DlgFunc
ListBox 10, 10, 150, 180, MyList(), .List1, 2
CancelButton 42, 198, 40, 12
OKButton 90, 198, 40, 12
End Dialog
Dim frame As BitmapDlg
' Show the bitmap dialog
Dialog frame
End Sub
Function DlgFunc( controlID As String, action As Integer, suppValue As Integer)
DlgFunc = 1 ' Keep dialog active
Select Case action
Case 1 ' Initialize
temp = Dir( "c:\Mach3\Gcode\*.tap" )
count = 0
While temp <> ""
count = count + 1
temp = Dir
Wend
Dim x() As String
ReDim x(count)
x(0) = Dir( "c:\Mach3\Gcode\*.tap" )
For i = 1 To count
x(i) = Dir
Next i
DlgListBoxArray "List1", x()
Case 2 ' Click
fileName = "c:\Mach3\Gcode\" & DlgText("List1")
End Select
End Function
End