Delete files

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
 
G

Guest

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
 
H

Herfried K. Wagner [MVP]

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'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top