View Single Post
  #1 (permalink)  
Old January 6th, 2005, 09:30 AM
savoym savoym is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Arlington, TX, USA.
Posts: 119
Thanks: 0
Thanked 1 Time in 1 Post
Default Problem with a method?

I am a newbie to C# and in the following method:

        private void LogToEventLog(string pstrEventLogName)
        {
            EventLog objEventLog = new EventLog();
            if ((!EventLog.SourceExists(pstrEventLogName)))
            {
                EventLog.CreateEventSource(pstrEventLogName, pstrEventLogName);
            }
            objEventLog.Source = pstrEventLogName;
            try
            {
                objEventLog.WriteEntry(this.ErrorAsString, EventLogEntryType.Error);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

The ERROR is:

The type or namespace name 'EventLog' could not be found (are you missing a using directive or an assembly reference?)

Here are my using statements:

using System;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Web.SessionState;
using System.Web;
using System.Configuration;
using System.IO;
using System.Text;

What am I missing?

Any help is appreciated. Thanks.
Reply With Quote