Deletes a log from the specified computer : EventLog « Windows « VB.Net Tutorial






Option Explicit
Option Strict

Imports System
Imports System.Diagnostics
Imports System.Threading

Class MySample
    Public Shared Sub Main()
        Dim logName As String

        If EventLog.SourceExists("MyOldSource", "myServer") Then
            logName = EventLog.LogNameFromSourceName("MyOldSource", "myServer")
            EventLog.DeleteEventSource("MyOldSource", "myServer")
            EventLog.Delete(logName, "myServer")

            Console.WriteLine((logName & " deleted."))
        End If
    End Sub
End Class








24.12.EventLog
24.12.1.Write to System EventLog
24.12.2.Display all Application EventLog
24.12.3.EventLogEntryType.Information
24.12.4.Deletes a log from the specified computer
24.12.5.Create the source MySource if it does not already exist, and writes an entry to the event log MyNewLog.