请问如何从OpenFileDialog中读取所有
文件名到List
Box Private Sub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button3.Click On Error Resume Next With OpenFileDialog1 .Multiselect = True .FileName = .Filter = Excel
文件(*.xls)|*.xls .FilterIndex = 1 End With OpenFileDialog1.ShowDialog() List
Box1.Items.Add(OpenFileDialog1.FileName) End Sub 请问如何从OpenFileDialog中读取所有
文件名到List
Box? __________________________________________________________________________ 问题已经
解决,不知是否正确? Private Sub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button3.Click On Error Resume Next Dim s As String With OpenFileDialog1 .Multiselect = True .FileName = .Filter = Excel
文件(*.xls)|*.xls .FilterIndex = 1 End With OpenFileDialog1.ShowDialog() For Each s In OpenFileDialog1.FileNames List
Box1.Items.Add(s) Next End Sub __________________________________________________________________________ 那你用选取
文件夹的方式好了。。。。 FolderBrowserDialog: If Me.FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then Me.List
Box1.DataSource = IO.Directory.GetFiles(Me.FolderBrowserDialog1.SelectedPath) End If __________________________________________________________________________ en 可以这么
解决 __________________________________________________________________________ With OpenFileDialog1 .Multiselect = True .FileName = .Filter = Excel
文件(*.xls)|*.xls .FilterIndex = 1 End With OpenFileDialog1.ShowDialog() List
Box1.Items.AddRange(OpenFileDialog1.FileNames) __________________________________________________________________________ 不必用循环而用List
Box.Items.AddRanage就可以加一个集合进来了,如上. __________________________________________________________________________ 高手啊! 佩服! __________________________________________________________________________ 感谢fangxinggood(JustACoder) 和平民百姓等高手! __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263431.html