by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 1st August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Delete a File using DeleteFile API
Private Sub Form_Load()
' Delete the file C:\karthik\waste.txt
Dim rtval As Long ' return value
rtval = DeleteFile("C:\karthik\waste.txt")
If rtval = 1 Then
MsgBox "File deleted successfully."
Else
MsgBox "Error"
End If
End
End Sub