Public Sub WriteLog(ByVal logMessage As String, ByVal vFileName As String) Try Dim vFullFilePath As String vFullFilePath = AppDomain.CurrentDomain.BaseDirectory.ToString & "Log\" Dim dir As New IO.DirectoryInfo(vFullFilePath) If dir.Exists = False Then dir.Create() 'Format(Date.Now, "d-MMM-yy") vFullFilePath = vFullFilePath & vFileName & GetDate() & ".txt" Dim tWrite As IO.TextWriter = IO.File.AppendText(vFullFilePath) tWrite.WriteLine(DateTime.Now.ToLongDateString() & vbTab & DateTime.Now.ToLongTimeString() & vbTab & logMessage) ' Update the underlying file. tWrite.Flush() tWrite.Close() Catch ex As Exception End Try End Sub