Erdenemandal
Well-known member
Hi , All
I have a problem . I want to save every operation into Log file. I have "Start", "working" form.
But strange thing is from "Start" form it writes into Log file and from "Working" form it does not write anything,
Can somebody help me-
this is a code
in module WriteLog function declared PUBLIC
in Start form
in Working form
I have a problem . I want to save every operation into Log file. I have "Start", "working" form.
But strange thing is from "Start" form it writes into Log file and from "Working" form it does not write anything,
Can somebody help me-
this is a code
in module WriteLog function declared PUBLIC
Code:
Public Sub WriteLog(ByVal text1 As String, ByVal Text2 As String)
If Not System.IO.Directory.Exists(CurDir() + "\sources\Logs\") Then
System.IO.Directory.CreateDirectory(CurDir() + "\sources\Logs\")
End If
Dim myLogName As String = CurDir() + "\sources\Logs\Running.log"
If System.IO.File.Exists(myLogName) Then
Dim FI As New System.IO.FileInfo(myLogName)
If FI.Length > 100000 Then
Dim dS As String = Date.Now.Today.ToShortDateString
dS = dS.Replace(".", "")
Dim dT As String = DateTime.Now.ToLongTimeString
dT = dT.Replace(":", "")
System.IO.File.Move(myLogName, CurDir() + "\sources\Logs\Log_" + dS + dT + ".bak")
End If
End If
Try
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(myLogName, True)
sw.WriteLine(Date.Now.Today.ToShortDateString + " " + DateTime.Now.ToLongTimeString + " : " + text1 + ControlChars.Tab + ControlChars.Tab + Text2)
sw.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
in Start form
Code:
WriteLog("Patient " & mPersonID & " has Logged in ", "DONE")
in Working form
Code:
WriteLog("Basci stimulation Started", "Done")