Option Explicit
Private Sub Command1_Click()
Dim killedfile As String,choicedfile As String 定义变量
Dim x
If Right(Dir1.Path,1) = "\" Then
choicedfile = Dir1.Path + File1.FileName
Else
choicedfile = Dir1.Path + "\" + File1.FileName
End If
killedfile = choicedfile 要删除的文件时所选文件
x = MsgBox("你确定要删除文件吗?",35,"确定框") 确认
If x = 6 Then 若返回值是6
Kill killedfile 将所选文件删除
MsgBox "文件已删除!请查看计算机上该文件所在的路径。","信息提示"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
成品图
原文链接:https://www.f2er.com/vb/260401.html