or using System.IO.directory
'directory.delete' will delete an empty directory
The old way was to delete all the files from the directory and then delete the directory.
Dhould the directory contasin sub directories, then you will need to recure through them to ensure all files are deleted and then delete the directory. If the directory contains files then you will recieve an error.
Private Sub Form_Load()
Dim MyDir As String
On Error GoTo ErrHandler
MyDir = "D:\Temp"
Kill MyDir & "\" & "*.*"
RmDir "D:\Temp"
Exit Sub
ErrHandler:
MsgBox Err.Number & " " & Err.Description, vbOKCancel, "This is a program generated error"
End Sub