Results 1 to 3 of 3

Thread: Common Dialog w/MultiSelect

  1. #1
    Guest

    Post

    Anyone know how to get the Common Dialog to use the Explorer look and feel (flag cdlOFNExplorer) and allow for multi-select (flag cdlOFNAllowMultiselect)?

    I've seen this in other applictaions (Office) where they use the common dialog file controil but allow multiple select. If I try (vb6) I get either have the old UI for files and multiselect or the new IE UI and NO multi-select.

    Ideas?

    -damian

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Try this:
    Code:
    'Add a Listbox, a CommonDialog and a Command button to a Form...
    Private Sub Command1_Click()
        Dim vFiles As Variant
        Dim iFile As Long
        
        With CommonDialog1
            .Flags = cdlOFNExplorer Or cdlOFNAllowMultiselect
            .ShowOpen
            vFiles = Split(.FileName, Chr(0))
            List1.Clear
            If UBound(vFiles) > 0 Then
                Caption = vFiles(0) 'Folder
                For iFile = 1 To UBound(vFiles)
                    List1.AddItem vFiles(iFile)
                Next
            Else
                Caption = Left$(.FileName, Len(.FileName) - Len(.FileTitle))
                List1.AddItem .FileTitle
            End If
        End With
    End Sub

  3. #3
    Guest

    Post

    Thanks! I did not know the OR could be used with the flags. Funny how MS doesn't document this.

    Thanks again.

    -Damian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width