Microsoft & .NETVisual BasicAdding Events to the NT Event Log

Adding Events to the NT Event Log

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Windows applications typically write to the NT event log to provide the user with useful information. In VB5/6, the App object now provides methods to make writing to the event log in Windows NT a snap:

'-- Start Event Logging
Call App.StartLogging("", vbLogToNT)

'-- Log Events to NT
Call App.LogEvent _
("Info", vbLogEventTypeInformation)
Call App.LogEvent _
("Error", vbLogEventTypeError)
Call App.LogEvent _
("Warning", vbLogEventTypeWarning)

Be aware though, these functions will only work in the compiled EXE. They will be ignored in design mode. Check out the Microsoft knowledge base article Q161306 for more information.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories