Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
OpenFileDialog1.Filter = "TEXT FILE | *.xml"
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
TextBox2.Text = OpenFileDialog1.FileName
End If
End Sub
TextBox没有显示多个文件,我在OpenFileDialog中允许多选,并且TextBox中的多行也被激活。谢谢!
答案 0 :(得分:1)
您需要使用Filenames
属性。由于它是一个数组,因此您需要将各个值连接在一起以将其放入文本框中。
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
TextBox2.Text = String.Join(",", OpenFileDialog1.FileNames)
End If