FileInfo class

  • Thread starter Thread starter VB Student
  • Start date Start date
V

VB Student

Sorry this might be a bit of a basic question but I have the following:

Dim myFI As System.IO.FileInfo
myFI = New System.IO.FileInfo("c:\myfile.txt")
myFI.Create()
 
FileInfo.Create() returns you a FileStream. Until this stream is closed, you
will not be able to delete the associated file.

So, the following should work:

.....
Dim fs As FileStream = myFI.Create()
.....
.....
fs.Close()
myFI.Delete()


Sorry this might be a bit of a basic question but I have the following:

Dim myFI As System.IO.FileInfo
myFI = New System.IO.FileInfo("c:\myfile.txt")
myFI.Create()
 
Back
Top