How do you delete files in VB.NET?
Printable View
How do you delete files in VB.NET?
VB Code:
IO.File.Delete("c:\myfile.exe")
There is a ton of good stuff in the IO namespace. The Path object also has some helpful functions.
Make sure that you wrap your file io operations in a try-catch block so your app doesn't crash when something unexpected happens.
At least make sure it exists:
VB Code:
If IO.File.Exists("c:\myfile.exe") Then IO.File.Delete("c:\myfile.exe") End If
Thanks for the help everyone!