K
kahsiang.wong
Hi there,
When there is a new entry in the event log I will create a new
instance of a form which shows the information in the event log.
However, once the new form is created, my application becomes
unresponsive.
Can anyone help me with it?
Public Overridable Sub NewMessageArrived(ByVal [source] As Object,
ByVal e As EntryWrittenEventArgs)
Dim Entry As EventLogEntry
Dim Result() As String
Entry = e.Entry
Dim TimeStamp As String
Dim MachineName As String
Dim MsgHeader As String
Try
Dim Sender As String
Dim Prefix As String = "Application popup: Messenger
Service : Message from "
If IsNothing(Entry) = True Then
Exit Sub
End If
MachineName = Entry.MachineName
TimeStamp = Entry.TimeWritten
Result = Entry.Message.Split(vbCrLf)
Sender = GetSenderID(Result(0))
MsgHeader = Prefix + Sender + " to " + MachineName + " on
" + TimeStamp + vbCrLf + vbCrLf
Dim str As String
str = Entry.Message.ToString
str = str.Replace(MsgHeader, "")
If ChatInSession(Sender) = False Then
Dim Chat As New frmChat
Me.AddOwnedForm(Chat)
Chat.Text = "Chat window with " + Names
Chat.Tag = UIDs
Chat.Show()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
When there is a new entry in the event log I will create a new
instance of a form which shows the information in the event log.
However, once the new form is created, my application becomes
unresponsive.
Can anyone help me with it?
Public Overridable Sub NewMessageArrived(ByVal [source] As Object,
ByVal e As EntryWrittenEventArgs)
Dim Entry As EventLogEntry
Dim Result() As String
Entry = e.Entry
Dim TimeStamp As String
Dim MachineName As String
Dim MsgHeader As String
Try
Dim Sender As String
Dim Prefix As String = "Application popup: Messenger
Service : Message from "
If IsNothing(Entry) = True Then
Exit Sub
End If
MachineName = Entry.MachineName
TimeStamp = Entry.TimeWritten
Result = Entry.Message.Split(vbCrLf)
Sender = GetSenderID(Result(0))
MsgHeader = Prefix + Sender + " to " + MachineName + " on
" + TimeStamp + vbCrLf + vbCrLf
Dim str As String
str = Entry.Message.ToString
str = str.Replace(MsgHeader, "")
If ChatInSession(Sender) = False Then
Dim Chat As New frmChat
Me.AddOwnedForm(Chat)
Chat.Text = "Chat window with " + Names
Chat.Tag = UIDs
Chat.Show()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub