#2
xyxcc1772017-10-28 12:54
|
程序代码:
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
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编辑过]