0
中的文件
有什麼錯誤使用此代碼? 我寫了這個程序刪除一些文件,而無需將其發送給我每次運行程序時回收站 並嘗試刪除文件(C)根 代碼菜單中顯示的錯誤告訴我,文件無法刪除無法刪除C:
Public Class Form1
Private Sub BtnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDelete.Click
Try
Dim x As String
x = txtfolder.Text
If txtfolder.Text = "" Then
MessageBox.Show("Write An Address Then Click ^Goto^", _
"Super Deleter", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
ElseIf MessageBox.Show("Are you sure You want to Delete File(s)?", _
"Super Deleter", MessageBoxButtons.YesNo, _
MessageBoxIcon.Warning) _
= DialogResult.Yes Then
My.Computer.FileSystem.DeleteFile(lstbox.SelectedItem)
MessageBox.Show("File Has been Deleted Successfuly!", _
"Siper Deleter", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
lstbox.Items.Clear()
For Each folder As String In _
My.Computer.FileSystem.GetFiles(x)
lstbox.Items.Add(folder)
Next
End If
Catch ex As Exception
MessageBox.Show("Can't Delete This File", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub gotobtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gotobtn.Click
Try
Dim x As String
x = txtfolder.Text
lstbox.Items.Clear()
For Each folder As String In _
My.Computer.FileSystem.GetFiles(x)
lstbox.Items.Add(folder)
Next
Catch ex As Exception
MessageBox.Show("Write An Address Then Click ^Goto^", _
"Super Deleter", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
End Try
End Sub
End Class
提升的權限的應用程序需要在某些目錄作用,窗口根文件夾(通常「C:\」)是其中的一個。 – Plutonix
爲什麼投了票? – chrisl08