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.GetEventLogs

Creates an array of the event logs.

Overload List

Searches for all event logs on the given computer and creates an array of EventLog objects to contain the list.

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

Searches for all event logs on the local computer and creates an array of EventLog objects to contain the list.

[Visual Basic] Overloads Public Shared Function GetEventLogs() As EventLog ()
[C#] public static EventLog[] GetEventLogs();
[C++] public: static EventLog* GetEventLogs() [];
[JScript] public static function GetEventLogs() : EventLog[];

Example [Visual Basic]

The following example gets a list of logs on the local computer. It then outputs the name of each log.

Import the System.Diagnostics namespace for this example.

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

[Visual Basic]

Private Sub GetLogList()
    'Declare an array of event logs.
    Dim EventLogList() As EventLog
    'This is used in a for loop
    Dim i As Integer

    'Show the name of each event log on the local computer.
    EventLogList = EventLog.GetEventLogs
    For i = 0 To EventLogList.Length - 1
        Console.WriteLine(EventLogList(i).Log)
    Next
End Sub

See Also

EventLog Class | EventLog Members | System.Diagnostics Namespace