Forms not responding

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kahsiang.wong@gmail.com

    #1

    Forms not responding

    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 NewMessageArriv ed(ByVal [source] As Object,
    ByVal e As EntryWrittenEve ntArgs)
    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 = "Applicatio n popup: Messenger
    Service : Message from "

    If IsNothing(Entry ) = True Then
    Exit Sub
    End If

    MachineName = Entry.MachineNa me
    TimeStamp = Entry.TimeWritt en


    Result = Entry.Message.S plit(vbCrLf)
    Sender = GetSenderID(Res ult(0))

    MsgHeader = Prefix + Sender + " to " + MachineName + " on
    " + TimeStamp + vbCrLf + vbCrLf
    Dim str As String
    str = Entry.Message.T oString
    str = str.Replace(Msg Header, "")


    If ChatInSession(S ender) = 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.ToStr ing)
    End Try

    End Sub

  • Cor Ligthert [MVP]

    #2
    Re: Forms not responding

    Chat.ShowDialog ()

    <kahsiang.wong@ gmail.comschree f in bericht
    news:1177634067 .672306.242730@ n35g2000prd.goo glegroups.com.. .
    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 NewMessageArriv ed(ByVal [source] As Object,
    ByVal e As EntryWrittenEve ntArgs)
    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 = "Applicatio n popup: Messenger
    Service : Message from "
    >
    If IsNothing(Entry ) = True Then
    Exit Sub
    End If
    >
    MachineName = Entry.MachineNa me
    TimeStamp = Entry.TimeWritt en
    >
    >
    Result = Entry.Message.S plit(vbCrLf)
    Sender = GetSenderID(Res ult(0))
    >
    MsgHeader = Prefix + Sender + " to " + MachineName + " on
    " + TimeStamp + vbCrLf + vbCrLf
    Dim str As String
    str = Entry.Message.T oString
    str = str.Replace(Msg Header, "")
    >
    >
    If ChatInSession(S ender) = 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.ToStr ing)
    End Try
    >
    End Sub
    >

    Comment

    • kah

      #3
      Re: Forms not responding

      Hi Cor,

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

      Thanks and Regards,
      Kah


      Comment

      • kah

        #4
        Re: Forms not responding

        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

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: Forms not responding

          Kah,

          Not in an easy way,

          Cor

          "kah" <kahsiang.wong@ gmail.comschree f in bericht
          news:1177635713 .282217.305810@ u32g2000prd.goo glegroups.com.. .
          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
          >

          Comment

          Working...