Public Function WriteToEventLog(ByVal Entry As String)
Dim appName As String = “Your Application”
Dim eventType As EventLogEntryType = EventLogEntryType.Error
Dim logName = “Application”
Dim objEventLog As New EventLog()
Try
If Not EventLog.SourceExists(appName) Then
EventLog.CreateEventSource(appName, logName)
End If
objEventLog.Source = appName
objEventLog.WriteEntry(Entry, eventType)
Return True
Catch Ex As Exception
Return False
End Try
End Function