I'm actually using a new instance of the form. Here's the call:
Code:
Private Sub StartChatToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles StartChatToolStripMenuItem.Click
Call New frmChat() With {.MdiParent = Me}.Show()
StartChatToolStripMenuItem.Enabled = False
End Sub
As you can see it was taken directly from your own MDIParent and children forms in your example. I browsed through your BackgroundWorker and default instance tutorails; I do not feel that multi-threading is really relevant. I'm going to look into using delegates.
Edit:
I didn't have to use a background worker or delegates. The error in using "Call New" is that you aren't identifying the form and thus can't use it on the UI thread, from what I understand.. even if you do use delegates. I'm using this instead and it works perfectly now:
Setting chlChat as our new instance.
Code:
Public Class mdiMain
Public chlChat As New frmChat()
Loading chlChat and using it:
Code:
Private Sub StartChatToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles StartChatToolStripMenuItem.Click
chlChat.MdiParent = Me
chlChat.Show()
StartChatToolStripMenuItem.Enabled = False
End Sub
Public Sub UpdateLog(ByVal msgtype As String, ByVal text As String, ByVal user As String)
Select Case msgtype.Trim
Case "SERVERINFO"
chlChat.rtbChat.SelectionColor = Color.Blue
chlChat.rtbChat.AppendText("Info: ")
chlChat.rtbChat.SelectionColor = Color.Black
chlChat.rtbChat.AppendText(text.Trim & ControlChars.NewLine)
chlChat.rtbChat.ScrollToCaret()
Case "SERVERMSG"
chlChat.rtbChat.SelectionColor = Color.Aqua
chlChat.rtbChat.AppendText("Server: ")
chlChat.rtbChat.SelectionColor = Color.Black
chlChat.rtbChat.AppendText(text.Trim & ControlChars.NewLine)
chlChat.rtbChat.ScrollToCaret()
Case "GLOBALCLIENTMSG"
chlChat.rtbChat.SelectionColor = Color.Blue
chlChat.rtbChat.AppendText("[" & user.Trim & "]: ")
chlChat.rtbChat.SelectionColor = Color.Black
chlChat.rtbChat.AppendText(text.Trim & ControlChars.NewLine)
chlChat.rtbChat.ScrollToCaret()
End Select
End Sub
And a picture of it all working:
http://imgur.com/9So0V