Author | Message | Time |
---|---|---|
Smurfling | Well for those who are interested: Grok's WriteLog in VB .NET [code] Imports System Imports System.IO Public Sub WriteLog(ByVal Text As String) Try Dim FileHolder As FileInfo _ = New FileInfo(Date.Now.Year & Date.Now.Month & Date.Now.Day & ".txt") Text = Text.Insert(0, "[" & Format(Date.Now.Hour, "00") _ & ":" & Format(Date.Now.Minute, "00") _ & ":" & Format(Date.Now.Second, "00") _ & ":" & Format(Date.Now.Millisecond, "0000") & "] ") If FileHolder.Exists Then Dim WriteFile As StreamWriter = FileHolder.AppendText() WriteFile.WriteLine(Text) WriteFile.Close() Else Dim WriteFile As StreamWriter = FileHolder.CreateText() WriteFile.WriteLine(Text) WriteFile.Close() End If Catch ex As Exception MsgBox(ex.ToString) End Try End Sub [/code] Usage - not that hard ;) [code] WriteLog("Well i really want to log now something :-)") [/code] | December 17, 2003, 9:42 AM |