I am upgrading to Visual Studio 2005 and have a problem with the following, hope someone can help me out:
{
EventLog aLogs = new EventLog();aLogs.Log =
"System"; //aLog.MachineName = machine;aLogs.EntryWritten +=
new EntryWrittenEventHandler(OnSysEntryWritten);aLogs.EnableRaisingEvents =
true;}
private static void OnSysEntryWritten(Object source, EntryWrittenEventArgs e){
if (e.Entry.EntryType == EventLogEntryType.Error){
string mBericht;mBericht =
"Source: " + e.Entry.Source + "\r\n" + "Datum/Tijd: " + e.Entry.TimeGenerated + "\r\n" + "Category: " + e.Entry.Category + "\r\n" + "Message: " + e.Entry.Message + "\r\n" + "EntryType: " + e.Entry.EntryType + "\r\n" + "EventID: " + e.Entry.EventID + "\r\n" + "UserName: " + e.Entry.UserName;Verstuur_email(
"Event Error " + e.Entry.EventID + " " + e.Entry.Source , mBericht, "", "");}
}
The e.Entry.EventID is working but gives a warning, "This Property has been deprecated." Tried to work it out myself but i can't find how to.
It should be replaced with System.Diagnostics.EventLogEntry.EventID