p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Problem with a method? (http://p2p.wrox.com/showthread.php?t=23538)

savoym January 6th, 2005 09:30 AM

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;
                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.

Vadivel January 6th, 2005 09:34 AM

using System.Diagnostics;

Best Regards


All times are GMT -4. The time now is 01:12 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.