NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

EventLog.Exists

Determines whether the specified log exists.

Overload List

Determines whether the log exists on the specified computer.

[Visual Basic] Overloads Public Shared Function Exists(String, String) As Boolean
[C#] public static bool Exists(String, String);
[C++] public: static bool Exists(String*, String*);
[JScript] public static function Exists(String, String) : Boolean;

Determines whether the log exists on the local computer.

[Visual Basic] Overloads Public Shared Function Exists(String) As Boolean
[C#] public static bool Exists(String);
[C++] public: static bool Exists(String*);
[JScript] public static function Exists(String) : Boolean;

Example [Visual Basic]

The following example determines if the log "myLog" exists on the local computer. If it does, it is deleted.

Import the System.Diagnostics namespace for this example.

Note   This example shows how to use one of the overloaded versions of Exists. For other examples that may be available, see the individual overload topics.

[Visual Basic]

Private Sub DeleteLog()
    'Declare an event log name
    Dim eventLogName As String
    eventLogName = "myLog"

    'If the event log passed in exists on the server, delete it.
    If EventLog.Exists(eventLogName) Then
        EventLog.Delete(eventLogName)
    End If
End Sub

See Also

EventLog Class | EventLog Members | System.Diagnostics Namespace