主题:怎样利用OpenFileDialog来为ListView添加项?
如题.功能代码我已经编写出来了,但是一运行就有错误,谁能帮我修改一下?
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
'设置事件状态栏显示
StatusBarPanel1.Text = "正在添加文件..."
'打开对话框
OpenFileDialog1.ShowDialog()
'存储文件名的数组
Dim FileNames() As String
'把打开的文件都加入到ListView上。
Dim FileName = OpenFileDialog1.FileNames
For i = 0 To FileNames.Length - 1 Step 1
ListView1.Items.Add(FileNames(i))
Next
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
'设置事件状态栏显示
StatusBarPanel1.Text = "正在添加文件..."
'打开对话框
OpenFileDialog1.ShowDialog()
'存储文件名的数组
Dim FileNames() As String
'把打开的文件都加入到ListView上。
Dim FileName = OpenFileDialog1.FileNames
For i = 0 To FileNames.Length - 1 Step 1
ListView1.Items.Add(FileNames(i))
Next
End Sub