Results 1 to 3 of 3

Thread: how can i make commondialog accept selecting more than one file?

  1. #1

    Thread Starter
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Compwiz is right. Next example will store all selected files in array (arrFileNames):


    Code:
        Dim strText As String
        Dim arrFileNames() As String
        Dim strBuffer As String
        Dim strDir As String
        Dim i As Integer
    
        With CommonDialog1
            .Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer
            .ShowOpen
            strText = .FileName
        End With
        
        strDir = Left(strText, InStr(strText, vbNullChar) - 1) & "\"
        strText = Mid(strText, InStr(strText, vbNullChar) + 1)
        
        Do Until strText = ""
            ReDim Preserve arrFileNames(i)
            If InStr(strText, vbNullChar) Then
                arrFileNames(i) = strDir & Left(strText, InStr(strText, vbNullChar) - 1)
                strText = Mid(strText, InStr(strText, vbNullChar) + 1)
            Else
                If strText <> "" Then
                    arrFileNames(i) = strDir & strText
                    strText = ""
                End If
            End If
            i = i + 1
        Loop

    arrFileNames now has all files stored as elements.


    Regards,

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


  2. #2
    Junior Member
    Join Date
    Sep 1999
    Location
    mousafah,abu-dhabi,UAE
    Posts
    29

    Post

    please, answer this question.

  3. #3
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Use the cdlOFNAllowMultiselect flag with the Common Dialog.

    ------------------
    Tom Young, 14 Year Old
    tyoung@stny.rr.com
    ICQ: 15743470
    AIM: TomY10
    PERL, JavaScript and VB Programmer

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