Forms not responding

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
 
K

kah

Hi Cor,

Your suggestions works like a charm. However could you please explain
why using ShowDialog works whereas Show failed?

Thanks and Regards,
Kah
 
K

kah

Hi,

Using ShowDialog, I am not able to set focus on the original form. The
only way is to close the new popup. Is there any other way i can go
about doing this?

Thanks and Regards,
Kah Siang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top