【发布时间】:2015-11-24 03:05:09
【问题描述】:
我需要:点击一个按钮时打开文件对话框,然后我会选择多个文件,然后点击确定,那么文件就会出现在Checkedlistbox1上。我希望对话框记住我上次浏览的文件夹路径(所以当我再次单击该按钮时,它将带我到该位置)。但是当我只运行“openfiledialog”时,我无法选择多个文件,并且当我添加更多代码时,程序会出错。请在这里阐明一下。 :)
Dim fbd As New OpenFileDialog With { _
.Title = "Select multiple files", _
.FileName = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}
If fbd.ShowDialog = DialogResult.OK Then
CheckedListBox1.Items.AddRange(Array.ConvertAll(IO.Directory.GetFiles(fbd.FileNames), Function(f) IO.Path.GetFileName(f)))
End If
【问题讨论】: