by Brandon (46 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 27th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Delete a file that exists on a 3.5 floppy disk.
'make sure to create the file byefile.txt on a 3.5 floppy
'to make sure the file is deleted after you execute this program.
Private Sub mnuEditDeleteFile_Click()
'delete a file existing on disk
Dim Delete
On Error GoTo ErrHandler:
Delete = MsgBox("Are you sure you want to delete this file?", vbYesNo + vbQuestion, "Delete File")
If Delete = vbYes Then
Kill "a:\byefile.txt"
End If
ErrHandler:
MsgBox "File does not exist, create a file to delete", vbCritical
End Sub