EntryWrittenEventArgs::Entry Property

 

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

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

public:
property EventLogEntry^ Entry {
	EventLogEntry^ get();
}

Property Value

Type: System.Diagnostics::EventLogEntry^

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 );
   }
   else
   {
      Console::WriteLine( "The current entry is null" );
   }
}

.NET Framework
Available since 1.1
Return to top
Show: