Delete files

  • Thread starter Thread starter Marty
  • Start date Start date
M

Marty

Hi,

In VB.NET, is there a similar way as in VB6 for deleting files?
Dim fsoFileSystemObj
Set fsoFileSystemObj = CreateObject("Scripting.FileSystemObject")

fsoFileSystemObj.deleteFile (strFilePath)

Thank you

Marty
 
Marty,

..Net's FileInfo class has a Delete method that can be used to delete a file.

The online docs on FileInfo give an example.

Kerry Moorman
 
Marty said:
In VB.NET, is there a similar way as in VB6 for deleting files?
Dim fsoFileSystemObj
Set fsoFileSystemObj = CreateObject("Scripting.FileSystemObject")
fsoFileSystemObj.deleteFile (strFilePath)

In VB6 I would have used 'Call Kill(FilePath)', and you can still use
'Kill(FilePath)' in .NET. Alternatively you can use
'System.IO.File.Delete'.
 
Back
Top