private static void WriteToEvent(string source, string message, EventLogEntryType evtType, int id)
{
//Folder Name under Applications and Services Logs
System.Diagnostics.EventLog objEventLog = new System.Diagnostics.EventLog(source);
objEventLog.Source = source;
objEventLog.WriteEntry(message, evtType, id);
}
WriteToEvent("MySource", "My Error ", EventLogEntryType.Error, 1110);
{
//Folder Name under Applications and Services Logs
System.Diagnostics.EventLog objEventLog = new System.Diagnostics.EventLog(source);
objEventLog.Source = source;
objEventLog.WriteEntry(message, evtType, id);
}
WriteToEvent("MySource", "My Error ", EventLogEntryType.Error, 1110);