Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

How can I iterate through a component collection and read the text of each of the compnent?

I'm using vs2005, .net 2.0.  I tried the following code to read the system Securitylog's but am getting error.  padLogEntry is an EventyLogEntry

IEnumerator IEnum = padLogEntry.Container.Components.GetEnumerator();
Error      2      Using the generic type 'System.Collections.Generic.IEnumerator<T>' requires '1' type arguments      C:\Projects\UnityAdmin\EventReport.cs      62
Avatar of Dmitry G
Dmitry G
Flag of New Zealand image

Try to change:

IEnumerator<Component> IEnum = padLogEntry.Container.Components.GetEnumerator();

ASKER CERTIFIED SOLUTION
Avatar of rameedev
rameedev
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lapucca
lapucca

ASKER

Hi rameedev,

I need to read the property of the "Security" log's entry.  I think they're stored as components and am wondering how can I read them.  thanks.

Hi anaki, I tried it but it gives an error.


Thanks.
You mean to say you want to read msgs in the Security EventLog...Can you clarify?
Avatar of lapucca

ASKER

When I double click on an entry of the "Security" log in the system's "Event Viewer", a Property window pops up.  In this window, there is a "Description" section that lists many different information like "User Name:, "Domain", "Login ID"......
How can I obtain each of this inforation in my program?  Thank you.
well the above code which i gave you...you can extract most of the information