Option Strict On
Public Module Checking
Private Const filename As String = "CheckFile.dat"
Public Sub Main()
Dim fn As Integer = FreeFile
Dim fileOpened As Boolean
Try
FileOpen(fn, filename, OpenMode.Append)
fileOpened = True
WriteLine(fn, 1605, Date.Now, "Books", 2.19)
Catch e As Exception
Console.WriteLine(e.GetType().Name & ": " & e.Message)
Finally
If fileOpened Then FileClose(fn)
End Try
End Sub
End Module
|