OpenDialog.Item

From Xojo Documentation

Method

OpenDialog.Item(zeroBasedIndex as Integer) As FolderItem

New in 2010r4

Supported for all project types and targets.

The items selected by the user in the OpenDialog.

Notes

If MultiSelect is True, then this provides access to the files that were selected. You can get the number of items from the Count property and you can access an individual item by passing a value for the zeroBasedIndex parameter. Item is zero-based.

Sample Code

Let user choose multiple files and displays them in a Listbox:

Dim dlg As New OpenDialog
dlg.ActionButtonCaption = "Select Files"
dlg.CancelButtonCaption = "Cancel"
dlg.SuggestedFileName = ""
dlg.Title = "Select Files"
dlg.PromptText = "Select one or more files"
dlg.InitialDirectory = SpecialFolder.Documents
dlg.MultiSelect = True
Dim f As FolderItem = dlg.ShowModal
Dim fileCount As Integer = dlg.Count

For i As Integer = 0 To fileCount - 1
Listbox1.AddRow(dlg.Item(i).Name)
Next