Mega Code Archive
Create the source MySource if it does not already exist, and writes an entry to the event log MyNewLog
Option Explicit
Option Strict
Imports System
Imports System.Diagnostics
Imports System.Threading
Class MySample
Public Shared Sub Main()
If Not EventLog.SourceExists("MySource") Then
EventLog.CreateEventSource("MySource", "MyNewLog")
Console.WriteLine("CreatingEventSource")
Return
End If
Dim myLog As New EventLog()
myLog.Source = "MySource"
myLog.WriteEntry("Writing to event log.")
End Sub
End Class