PDA

Click to See Complete Forum and Search --> : how can i make commondialog accept selecting more than one file?


Serge
Nov 11th, 1999, 01:16 AM
Compwiz is right. Next example will store all selected files in array (arrFileNames):



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 (http://www.icq.com/51055819)

Ahmed Walid
Nov 11th, 1999, 11:15 AM
please, answer this question.

Compwiz
Nov 11th, 1999, 11:17 AM
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