Is there a way to verify that the file is open? The only thing I can think of is Try/Catch to see if I can catch an exception with an open file, but I decided that the method would be available to return true / false if the file was open.
Currently, System.IO used and the following code is under a class called Wallet .
Private holdPath As String = "defaultLog.txt" Private _file As New FileStream(holdPath, FileMode.OpenOrCreate, FileAccess.ReadWrite) Private file As New StreamWriter(_file) Public Function Check(ByVal CheckNumber As Integer, ByVal CheckAmount As Decimal) As Decimal Try file.WriteLine("testing") file.Close() Catch e As IOException 'Note sure if this is the proper way. End Try Return 0D End Function
Any pointers would be appreciated! Thanks!
Dayan
source share