OpenDialog.MultiSelect

From Xojo Documentation

Revision as of 17:24, 13 August 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Property (As Boolean )
aOpenDialog.MultiSelect = newBooleanValue
or
BooleanValue = aOpenDialog.MultiSelect

New in 2010r4

Supported for all project types and targets.

If True, the dialog supports multiple file selections. The default is False.

Notes

ShowModal still returns a FolderItem, but in the case of a MultiSelect OpenDialog, the FolderItem returned will be the first selection. To obtain a list of all the selected FolderItems we’ve added the Item(zeroBasedIndex As Integer) As FolderItem and Count As Integer properties.

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