Write To Windows Event Log ...
Write To Windows Event Log ...
Rate Write To Windows Event Log ...
(2(2 Vote))
WriteToEventLog("Hello Where Are U", EventLogEntryType.Information, "VB.Net Application", "Application")
End Sub
Private Function WriteToEventLog(ByVal Entry As String, ByVal LogEntryType As System.Diagnostics.EventLogEntryType, _
Optional ByVal AppName As String = "VB.Net Application", _
Optional ByVal LogName As String = "Application") As Boolean
Dim objeventlog As New EventLog()
Try
If EventLog.SourceExists(AppName) = False Then
EventLog.CreateEventSource(AppName, LogName)
End If
objeventlog.Source = AppName
objeventlog.WriteEntry(Entry, LogEntryType)
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
objeventlog.Dispose()
End Try
End Function
Write To Windows Event Log ... Comments
No comments yet — be the first to post one!
Post a Comment