Home All Groups Group Topic Archive Search About
Author
31 Jan 2006 7:34 PM
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

Author
31 Jan 2006 7:56 PM
Ken Halter
"Bob" <bduf***@sgiims.com> wrote in message
news:OvNKk6pJGHA.524@TK2MSFTNGP09.phx.gbl...
> 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



--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Author
31 Jan 2006 7:57 PM
Ken Halter
"Bob" <bduf***@sgiims.com> wrote in message
news:OvNKk6pJGHA.524@TK2MSFTNGP09.phx.gbl...
> This code works in vs2003 vb.net

Oops... It's ME that's in the wrong group! Now that's a new one! :-)

Sorry 'bout dat

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Author
31 Jan 2006 7:57 PM
Herfried K. Wagner [MVP]
"Bob" <bduf***@sgiims.com> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Feb 2006 9:08 AM
Cor Ligthert [MVP]
Bob,

Annoying, however the answer is as Herfried writes.

:-)

Cor