VB icon

Read / Write information to the Windows XP / 2000 / NT (?) Event Log (Admin Tools item > Event Log)

Email
Submitted on: 1/1/2015 1:06:00 AM
By: Jon Barker (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: VB.NET
Views: 1188
 
     This simple code will write to the windows Event Logger, which can be read by going into Control Panel > Admin Tools > Event Logger. Useful for diagnostics after compile time, when you have no debug window. YOU NEED TO ADD THE 'EVENT LOG' CONTROL FROM THE 'COMPONENTS' MENU TO YOUR FORM!
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Read / Write information to the Windows XP / 2000 / NT (?) Event Log (Admin Tools item > Event Log)
// Description:This simple code will write to the windows Event Logger, which can be read by going into Control Panel > Admin Tools > Event Logger. Useful for diagnostics after compile time, when you have no debug window.
YOU NEED TO ADD THE 'EVENT LOG' CONTROL FROM THE 'COMPONENTS' MENU TO YOUR FORM!
// By: Jon Barker (from psc cd)
//**************************************

'ADD AN EVENTLOG TO YOUR FORM!
Dim Log As New EventLog()
'======== Adds an entry ========
Log.WriteEntry("Program Name", "Text you wish to add to the log, write here", EventLogEntryType.Error, "1", "1")
'======== Deletes entry ===
log.Delete("Program Name")
'===== Search for entry ===
Dim r as boolean
r = log.Exists("Name of program")
'r will return true, or false
'==== Get all entries ==
Dim r As Array
r = log.GetEventLogs()
'r is now an array containing all the entries of the log.
tHe_cLeanER


Other 12 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.