EntryWrittenEventArgs.Entry EntryWrittenEventArgs.Entry EntryWrittenEventArgs.Entry EntryWrittenEventArgs.Entry Property


Gets the event log entry that was written to the log.

 property System::Diagnostics::EventLogEntry ^ Entry { System::Diagnostics::EventLogEntry ^ get(); };
public System.Diagnostics.EventLogEntry Entry { get; }
member this.Entry : System.Diagnostics.EventLogEntry
Public ReadOnly Property Entry As EventLogEntry

Property Value

An EventLogEntry that represents the entry that was written to the event log.


The following example assumes that you have already implemented the sample in EntryWrittenEventArgs(EventLogEntry).

It creates a custom EventLog object and writes an entry into it. Then it creates an EntryWrittenEventArgs object using the first entry in the custom EventLog. This object is used to notify a message.

void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e )
   EventLogEntry^ myEventLogEntry = e->Entry;
   if ( myEventLogEntry )
      Console::WriteLine( "Current message entry is: '{0}'", myEventLogEntry->Message );
      Console::WriteLine( "The current entry is null" );
protected static void MyOnEntry(Object source, EntryWrittenEventArgs e)
    EventLogEntry myEventLogEntry = e.Entry;
    if (myEventLogEntry != null)
        Console.WriteLine("Current message entry is: '"
                          + myEventLogEntry.Message + "'");
        Console.WriteLine("The current entry is null");
Protected Shared Sub MyOnEntry(source As Object, e As EntryWrittenEventArgs)
   Dim myEventLogEntry As EventLogEntry = e.Entry
   If Not (myEventLogEntry Is Nothing) Then
      Console.WriteLine("Current message entry is: '" + _
                                          myEventLogEntry.Message + "'")
      Console.WriteLine("The current entry is null")
   End If
End Sub 'MyOnEntry

Applies to