B
Bob
This code works in vs2003 vb.net
Public Sub WriteLogEntry( _
ByVal logName As String, _
ByVal logSource As String, _
ByVal logEntry As String, _
ByVal logType As System.Diagnostics.EventLogEntryType, _
ByVal logID As Integer, _
ByVal category As Short)
'Arguments : logName - The name of the log
' logSource - The source that writes the log
' logEntry - The text of the new message to log
' logType - The type of log to enter (error, failure
' audit, information, success audit, warning)
' logID - An integer that sets the entry's ID
' category - The category for the entry
Dim myLog As New System.Diagnostics.EventLog()
myLog.Log = logName
' Create the source, if it does not already exist.
If Not System.Diagnostics.EventLog.SourceExists(logSource) Then
System.Diagnostics.EventLog.CreateEventSource(logSource, logName)
End If
myLog.WriteEntry(logSource, logEntry, logType, logID, category)
End Sub
IN THE ide OF vs2005 i get
Warning 1 Access of shared member, constant member, enum member or nested
type through an instance; qualifying expression will not be evaluated.
D:\ProjetsVBNet\test\Form1.vb 84 9 test on word in last line mylog.
OK I'll play, what's it mean and what do I have to do to fix this?
Any help appreciated.
Bob
Public Sub WriteLogEntry( _
ByVal logName As String, _
ByVal logSource As String, _
ByVal logEntry As String, _
ByVal logType As System.Diagnostics.EventLogEntryType, _
ByVal logID As Integer, _
ByVal category As Short)
'Arguments : logName - The name of the log
' logSource - The source that writes the log
' logEntry - The text of the new message to log
' logType - The type of log to enter (error, failure
' audit, information, success audit, warning)
' logID - An integer that sets the entry's ID
' category - The category for the entry
Dim myLog As New System.Diagnostics.EventLog()
myLog.Log = logName
' Create the source, if it does not already exist.
If Not System.Diagnostics.EventLog.SourceExists(logSource) Then
System.Diagnostics.EventLog.CreateEventSource(logSource, logName)
End If
myLog.WriteEntry(logSource, logEntry, logType, logID, category)
End Sub
IN THE ide OF vs2005 i get
Warning 1 Access of shared member, constant member, enum member or nested
type through an instance; qualifying expression will not be evaluated.
D:\ProjetsVBNet\test\Form1.vb 84 9 test on word in last line mylog.
OK I'll play, what's it mean and what do I have to do to fix this?
Any help appreciated.
Bob