Determining Status of FileStream, etc.

TedN

Active member
Joined
Sep 25, 2006
Messages
35
Is there a way to determine if a FileStream, CryptoStream, etc. is closed or open.

Ive tried things like:

Code:
If fs.Closed() = True Then
    Blah, blah
End If

But that doesnt work.

Thanks,
Ted
 
CanRead and CanWrite

I suggest checking both the CanRead and CanWrite properties. If the Stream is closed, they will both return false. If the Stream is open, I would expect at least one of them to return true, otherwise the Stream is essentially useless.

Code:
If Not (fs.CanRead Or fs.CanWrite) Then
    Assume closed
End If

Good luck :cool:
 
Back
Top