Grazie per i vostri suggerimenti, ma ho risolto il problema e inserisco il codice che ho utilizzato.
'''''''''''''''''''''''''''''''''''''''''''''''
Imports System
Imports System.Diagnostics
Class MyEventlogClass
Public Shared Sub Main()
Dim myEventType As String = Nothing
Dim ora As String
Dim min As String
Dim myEventLog As New EventLog("System", ".")
Console.WriteLine("1:Information")
Console.WriteLine("Select the Event Type")
Dim myOption As Integer = Convert.ToInt32(Console.ReadLine())
Select Case myOption
Case 1
myEventType = "Information"
Case Else
End Select
Dim myLogEntryCollection As EventLogEntryCollection = myEventLog.Entries
Dim myCount As Integer = myLogEntryCollection.Count
Dim i As Integer
For i = myCount - 1 To -1 Step -1
Dim myLogEntry As EventLogEntry = myLogEntryCollection(i)
Dim str As Long
Dim dent As String
str = myLogEntry.InstanceId
If str = 2147489653 Then
dent = myLogEntry.TimeWritten.Date
If Dataorario = dent Then
ora = myLogEntry.TimeWritten.Hour()
If Len(ora) = 1 Then
ora = "0" & ora
End If
min = myLogEntry.TimeWritten.Minute
If Len(min) = 1 Then
min = "0" & min
End If
horario = ora & ":" & min
Exit Sub
End If
End If
Next i
End Sub
End Class
Ciao a tutti

Rispondi quotando