VB CommonDialog1 选择多个文件

2024-10-14 10:52:41

1、新建工程,点 工旯皱镢涛程,点 部件,选中如图控件VB CommonDialog1 选择多个文件

3、输入以下代码

Private Sub Command1_Click()

List1.Clear

CommonDialog1.MaxFileSize = 32767

CommonDialog1.DialogTitle = "打开文件 可同时选择多个文件"

CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer '

CommonDialog1.Filter = "所有文件(*.*)|*.*"

CommonDialog1.ShowOpen

a = Split(CommonDialog1.FileName, Chr(0))

For i = 1 To UBound(a)

List1.AddItem a(0) & "\" & a(i)

Next i

errhandler:

If Err = 32755 Then Exit Sub '选择了取消

End Sub

4、点击运行,试试效果VB CommonDialog1 选择多个文件VB CommonDialog1 选择多个文件

猜你喜欢