سلام دوستان خوبم
چطوری میشه توی Microsoft Common Dialog قسمتی که پنجره OPen رو باز می کنی بتونی چندتا فایل رو باهم انتخاب کنی.
چون خاصیت Multi Select توش نداره .
لطفا کمکم کنید.
ممنونم. :rolleye:
Printable View
سلام دوستان خوبم
چطوری میشه توی Microsoft Common Dialog قسمتی که پنجره OPen رو باز می کنی بتونی چندتا فایل رو باهم انتخاب کنی.
چون خاصیت Multi Select توش نداره .
لطفا کمکم کنید.
ممنونم. :rolleye:
بدون شرح.
کد:Private Sub Command1_Click()
On Error GoTo cError
Dim i As Integer
Dim myFiles() As String
Dim myPath As String
With CommonDialog1
.MaxFileSize = 32000 'this will max out the buffer for the filenames array for large selections. *NEW*
.CancelError = True 'if cancel is pressed, the code jumps to cError because of the On Error statement above
.Filter = "All Files *.*/*.*" '*NOTE!!* The / should be a vertical pipe symbol here! It displays incorrectly here.
.Flags = CD_FLAGS 'this is where we tell it to use multiselect
.ShowOpen
myFiles = Split(.FileName, vbNullChar) 'the Filename returned is delimeted by a null character because we selected the cdlOFNLongNames flag
Select Case UBound(myFiles)
Case 0 'if only one was selected we are done
List1.AddItem myFiles(0)
Case Is > 0 'if more than one, we need to loop through it and append the root directory
For i = 1 To UBound(myFiles)
myPath = myFiles(0) & IIf(Right(myFiles(0), 1) <> "\", "\", "") & myFiles(i)
List1.AddItem myPath
Next i
End Select
End With
Exit Sub
cError:
Beep
MsgBox Err.Description '*NEW*
End Sub
;) ;) :wac: :blink: :jealous:
اين يعني چي؟ سوالي داري؟