well i have looked at your code and i have tried it and didnt works so as usual i degub it.Code:Public Sub messageReceived(ByVal sender As ConnectedClient, ByVal message As String) 'A message has been received from one of the clients. 'To determine who its from, use the sender object. 'sender.SendMessage can be used to reply to the sender. Dim strg As String Dim data() As String = message.Split("|"c) 'Split the message on each | and place in the string array. Select Case data(0) Case "CONNECT" 'We use GetClientByName to make sure no one else is using this username. 'It will return Nothing if the username is free. 'Since the client sent the message in this format: CONNECT|UserName, the username will be in the array on index 1. If GetClientByName(data(1)) Is Nothing Then 'The username is not taken, we can safely assign it to the sender. sender.Username = data(1) End If Case "DISCONNECT" removeClient(sender) Case "MSG" 'Dim message1 As String = data(1) 'MsgBox(messag) 'TextBox1.Text = message1 strg = richtextbox1.text + (Chr(13) & Chr(10)) & data(1) trackchat(strg) End Select End Sub Private Delegate Sub trackchatinvoker(ByVal text As String) Private Sub trackchat(ByVal text As String) If RichTextBox1.InvokeRequired Then Me.RichTextBox1.Invoke(New trackchatinvoker(AddressOf trackchat), text) Else Me.RichTextBox1.Text = text End If End Sub
i found out that in the sub trackchat the red line does not execute.
i am sure that there is some small thing that i am missing and that is why it isnt working.Code:Private Delegate Sub trackchatinvoker(ByVal text As String) Private Sub trackchat(ByVal text As String) If RichTextBox1.InvokeRequired Then Me.RichTextBox1.Invoke(New trackchatinvoker(AddressOf trackchat), text) Else Me.RichTextBox1.Text = text End If End Sub




Reply With Quote