0

我有一个基本程序,可以将文件复制到临时目录,提取文件然后打开文件。然后我想要做的是从应用程序关闭的目录中删除文件。

4

2 回答 2

0

Simply create a function that handles the FormClosing event and put the code in there to delete the file.

Sub frmMain_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
于 2013-08-23T14:30:00.567 回答
0

在我关闭我的应用程序 vb 工作室后,我使用它来删除我的所有扫描日志

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

    Dim s As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

    Dim c As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)

    If My.Computer.FileSystem.FileExists(s & "/jrt.txt") Then
        My.Computer.FileSystem.DeleteFile(s & "/jrt.txt")
    End If

    If My.Computer.FileSystem.FileExists(s & "/Rkill.txt") Then
        My.Computer.FileSystem.DeleteFile(s & "/Rkill.txt")
    End If

    If My.Computer.FileSystem.FileExists(c & "/Documents/cc*.reg") Then
        My.Computer.FileSystem.DeleteFile(c & "/Documents/cc*.reg")
    End If

    If My.Computer.FileSystem.DirectoryExists("c:/AdwCleaner") Then
        My.Computer.FileSystem.DeleteDirectory("C:/AdwCleaner", FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently)
    End If
End Sub
于 2016-03-31T17:40:06.983 回答