我无法使用 OpenFileDialog 类显示多个文件名。我已经选择了Multiselect设置为true,并且可以在DialogBox中选择多个文件,但是TextBox1区域只打印了1个文件。
这是我的代码:
Public Class Form2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
End Sub
Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
' Dialog Result
Dim FilesSelected As DialogResult
' Are Files Selected?
If (FilesSelected = System.Windows.Forms.DialogResult.OK) Then
' If Files Identify Array
Dim file() As String
file = OpenFileDialog1.FileNames
For Each file In OpenFileDialog1.FileNames
TextBox1.Text = (CurDir() & "")
Next
End If
End Sub
End Class