home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
source
/
chap05
/
debug.bas
next >
Wrap
BASIC Source File
|
1995-07-12
|
755b
|
28 lines
Attribute VB_Name = "DebuggingLibrary"
Option Explicit
#Const DebugMode = True
Public Function Assert(Condition As Boolean, Message As String) As Boolean
If Not Condition Then
#If DebugMode Then
Dim style, Title
style = vbCritical Or vbOKOnly
Title = "ERROR MESSAGE"
MsgBox Message, style, Title
Stop
#Else
Dim FileName As String, FileNum As Integer
Dim buf As String
buf = Date$ & Chr$(9) & Time$ & Chr$(9) & Message
FileName = App.Path & "\error.log"
FileNum = FreeFile
Open FileName For Append As #FileNum
Print #FileNum, Date$, Time$, Message
Close #FileNum
#End If
End If
Assert = Condition
End Function