Note that in your code, you are actually instantiating two FileStream objects:
But, in the end, your f.Close() only closes the second one - you lose the reference to the first one when you reassign f on the second line of the code I copied.Code:Dim f As FileStream = New FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 8192) f = New FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
The solution of your problem would be to delete one of the constructor calls so you only create one FileStream object. You can also condense the code to this:
Code:Dim f As New FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)





Reply With Quote
