Adds an event handler for the System.Diagnostics.EventLog.EntryWritten event.
[Visual Basic] Overridable Public Sub AddOnEntryWritten( _ ByVal handler As EventLogEventHandler _ ) [C#] public virtual void AddOnEntryWritten( EventLogEventHandler handler ); [C++] public: virtual void AddOnEntryWritten( EventLogEventHandler* handler ); [JScript] public function AddOnEntryWritten( handler : EventLogEventHandler );
Exception Type | Condition |
---|---|
ArgumentException | The handler parameter is a null reference (Visual Basic Nothing). The handler might not have been initialized. |
ArgumentException | A value is not specified for the Log property. Make sure the log name is not an empty string. |
SystemException | The method cannot create a system event to notify the log to start monitoring for events. |
Exception | The log cannot be opened. No Windows error code is available. |
Win32Exception | The log cannot be opened. A Windows error code is available. |
This method causes the handler to start accepting events being posted to the active log.
EventLog Class | EventLog Members | System.Diagnostics Namespace