How to read the message of the event log using System.Management classes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • beginerVB
    New Member
    • Jan 2011
    • 2

    How to read the message of the event log using System.Management classes?

    I am able to query/read the "Applicatio n" event log using System.Manageme nt classes in VB.net 2005 (win xp)
    But I have problem reading the "Message" / "descriptio n" of my custom event log.
    I am getting a System.NullRefe renceException{ "Object reference not set to an instance of an object."}
    while reading the "Message" / "Descriptio n of the event log while it is reading the others properties.

    Also when I use System.Diagnost ics.EventLog and read all the Events on by one I am able to read
    the message/description of my custom event log.

    Why is that the System.Manageme nt classes can't read the my custom event log messages while the
    System.Diagnost ics.EventLog classes can read them.

    The reason I want to use System.Manageme nt classes is bcoz I can query my custom event log
    where as with System.Diagnost ics.EventLog classes I have to read the whole event log.

    Note:
    My custom event log message is really big enough.
Working...