I have the following to read the "System" Event Log.
What i want to be able to do is for the app to only read the "Errors" in the event log.
Does anyone know of a way i can do this?
Thanks for the help
VB.NET:
SetupEventsListView()
Dim elEvent As New System.Diagnostics.EventLog("System")
Dim elEventEntry As System.Diagnostics.EventLogEntry
For Each elEventEntry In elEvent.Entries
Dim li As New ListViewItem()
With li
.Text = elEventEntry.EntryType.ToString
.SubItems.Add(elEventEntry.TimeGenerated.ToString)
.SubItems.Add(elEventEntry.Source.ToString)
.SubItems.Add(elEventEntry.Category.ToString)
.SubItems.Add(elEventEntry.EventID.ToString)
If elEventEntry.UserName Is Nothing Then
.SubItems.Add("N/A")
Else
.SubItems.Add(elEventEntry.UserName.ToString)
End If
.SubItems.Add(elEventEntry.MachineName.ToString)
.SubItems.Add(elEventEntry.Message.ToString)
End With
lvwEvents.Items.Add(li)
li = Nothing
lvwEvents.Refresh()
Next
What i want to be able to do is for the app to only read the "Errors" in the event log.
Does anyone know of a way i can do this?
Thanks for the help