求助:在listview中显示的文件信息(包括文件名/文件路径),想实现删除功能,但不能实现彻底删除所选项的文件?
大家帮帮我看看代码,问题出在哪,尝试了好多遍了,谢谢!程序代码:
Try Dim dfpath As String = NodeDrives.SelectedItem.ToString Dim dfi As DirectoryInfo = New DirectoryInfo(dfpath) Dim file As FileInfo() = dfi.GetFiles(".", SearchOption.AllDirectories) Dim fiTemp As FileInfo For Each fiTemp In file Dim lifile() As String = {fiTemp.Name, fiTemp.FullName, fiTemp.Extension, fiTemp.LastWriteTime} If lifile(0) = ListView1.SelectedIndices.ToString Then Dim dpath As String = fiTemp.FullName Dim fi As FileInfo = New FileInfo(dpath) fi.Delete() End If Next Catch ex As Exception MessageBox.Show(ex.Message) End Try
[此贴子已经被作者于2017-10-27 08:28编辑过]