Ok, not to be dense, but I have looked at the examples, and played with some of the commands, and still have not achieved the right solution.
Below is my code (commented out code was from prior attempts, and the FileType is not active yet… I keep seeing referenced in the examples, and I do know I found in the docs once, but have not found it again or figured out how to use them yet…). It takes me to the default directory, and I can select it (still can’t get it to select automatically), but it will not populate the list box.
In the bold section below, I have used dim u As Integer = dlg.InitialDirectory.Count to determine the number of files in the directory, and it returns an integer (the MsgBox line confirms this), but line [ if not dlg.item(i).Directory Then] gives me an out of bounds error… however, when this part was used in a global method (another attempt, another example tried) this par worked? Why does it not work in this instance?
Dim TransType As New FileType
TransType.Name = “text/trn”
TransType.MacType = “TRN”
TransType.MacCreator = “trn”
TransType.Extensions = “trn”
'selectedDir = SelectFolder
'displayDirItems()
'SpecialFolder.Desktop.Child(“Some folder”)
Dim dlg as OpenDialog
Dim f, datadir as FolderItem
'datadir="//files/restored/ameritrade data"
dlg=New OpenDialog
dlg.ActionButtonCaption=“Action Button”
dlg.CancelButtonCaption=“Cancel Button”
dlg.SuggestedFileName="-.trn"
dlg.Title=“Title bar text”
dlg.PromptText=“Prompt Text”
dlg.Left=50
dlg.Top=50
'selectedDir= New OpenDialog
#If Not (TargetLinux) then
f=SpecialFolder.Documents
#Else //open Home directory on linux
'dlg.InitialDirectory= datadir
'f =SpecialFolder.Home.Child(“Documents/Ameritrade”)
dlg.InitialDirectory=SpecialFolder.Documents.Child("/Ameritrade")
''displayDirItems()
'dlg.InitialDirectory="//files/restored/ameritrade data/"
#endif
dlg.Title=“Select a file”
'dlg.Filter=FileType.TransType //mif file type defined in FileTypes1 set
f=dlg.ShowModal()
[b]]If f <> Nil then
filFiles.DeleteAllRows
dim u As Integer = dlg.InitialDirectory.Count
MsgBox str(u)
for i As Integer = 1 to u
if not dlg.item(i).Directory Then
filFiles.AddRow dlg.Item(i).DisplayName
end if[/b]
Next
[/b]
'SelectedDir= f.PathTypeURL
'selectedDir = f.NativePath
displayDirItems()
//proceed normally
Else
//User Cancelled
End if