EventLog.WriteEvent

Hi,

I would like to write errors for my application to the eventlog with the error icon so that its easy to see whats an error and wants an information for my log.

Today I use .WriteEntry("myMessage...") witch is no problem, it generates a message entry with an information icon in the event log. So far so good...

What I understand is if I want to write an error I have to use .WriteEvent to get the error icon and read about this but what I dont understand is the part with EventLogMsgs.mc (a resorce file) I dont find any sample how to create a resorce file and how to use it in a VB.NET 2005 Windows application.

Does anyone has a small complete VB.NET sample of how to do this

With best regards

Cyril Porseland (Sweden)

 

 

 




Answer this question

EventLog.WriteEvent

  • Bhawna

    WriteEvent is used to write strings when they have been localized.  This is done by using the message compiler (from Win32) to create a resource that contains the localized strings.  You don't need to do this to write errors to the event log.

    One of the overloads for WriteEntry accepts an EventLogEntryType.  This parameter specifies the type of event to generate: audit, error, warning, etc.  Use this instead.

    Michael Taylor - 1/5/06


  • EventLog.WriteEvent