Whats this

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
 
K

Ken Halter

Bob said:
This code works in vs2003 vb.net

but not any language this group supports....

You'll want to post that question in a .Net group.
They all contain "dotnet" or "vsnet" in their names.
This and all other groups on the MS server that start with
"microsoft.public.vb"
are for VB Classic (mostly VB5/6) and were in existance long before any .Net
products were released. While some of the code looks the same, they are very
different products and require a different set of groups.

Try one of these:
news://news.microsoft.com/microsoft.public.dotnet.general
news://news.microsoft.com/microsoft.public.dotnet.languages.vb
news://news.microsoft.com/microsoft.public.dotnet.languages.vb.controls
news://news.microsoft.com/microsoft.public.dotnet.framework.interop
 
H

Herfried K. Wagner [MVP]

Bob said:
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.

Simply replace the text in front of the method call/member access with the
name of the class that contains the member instead of an object reference.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Urgent 2
Requested registry access is not allowed. 0
Problem with EventLog 2
June 2005 EAL Question 4
EventLog does not write 2
Whats the difference? 13
EventViewer using 1
Windows Service help (VB.Net) 5

Top