File Access problem

sj1187534

Well-known member
Joined
Jun 10, 2003
Messages
108
Location
Dallas, Houston, etc.etc.
Hi...I am having a problem with accessing the file. Heres the code that I am trying to execute.
==========================================
Dim proStat As New FileInfo("temp.tmp")
If proStat.Exists Then
Return True
Else
proStat.Create()
Return False
End If
==========================================

Later in the program, I am trying to delete this file in this way.

==========================================
Dim flinfo As New FileInfo("temp.tmp")
flinfo.Delete()
==========================================
At this point, it is giving me an error that the file is already being used by another process. i am not using this file anywhere in the program except these two. And, I guess we have no explicit way to "close" the file in the first instance since the FileInfo class has no such method.

What do you think is the problem here?

Thanks
SJ
 
Never mind..I was able to figure out whats wrong...I just changed the way I am creating the file.

==========================================
Dim proStat As New FileInfo("temp.tmp")
If proStat.Exists Then
Return True
Else
proStat.Create().Close()
Return False
End If
==========================================
 
Back
Top