I'm making a simple 2 person chat prog. I want to have different colors for the user names for "UserA" and "UserB" and for them to be in bold. The colors dont work they way I would like them to. The colors only appear on UserA, (the one who was listening for the connection request), and it doesnt have separate coloring for either user. Just one color or the other. Here is partial source for my program: (Just the coloring Sub's and the locations they are called from)
Thanks in advance.Code:Private Sub b_sendout_Click() Winsock1.SendData t_input.Text AddUserText "You", t_input.Text t_input.Text = "" End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Winsock1.GetData incomingbuffer, vbString AddRecipText "Recipiant", incomingbuffer End Sub Sub AddRecipText(Username As String, Text As Variant) t_output.SelStart = Len(t_output.Text) t_output.SelLength = 0 t_output.SelBold = True t_output.SelColor = RGB(0, 0, 255) t_output.Text = t_output.Text & Username & " said: " t_output.SelStart = Len(t_output.Text) t_output.SelLength = 0 t_output.SelBold = False t_output.SelColor = RGB(0, 0, 0) t_output.Text = t_output.Text & Text & vbCrLf 't_output.SelBold = False 't_output.SelColor = RGB(0, 0, 0) End Sub Sub AddUserText(Username As String, Text As Variant) t_output.SelStart = Len(t_output.Text) t_output.SelLength = 0 t_output.SelBold = True t_output.SelColor = RGB(255, 0, 0) t_output.Text = t_output.Text & Username & " said: " t_output.SelStart = Len(t_output.Text) t_output.SelLength = 0 t_output.SelBold = False t_output.SelColor = RGB(0, 0, 0) t_output.Text = t_output.Text & Text & vbCrLf 't_output.SelBold = False 't_output.SelColor = RGB(0, 0, 0) End Sub --Descriptions of controls-- t_output - RichText - Where the "chat log" is displayed. t_input - TextBox - Where you would type the message that is sent. t_Ipcon - TextBox - User enters IP or Hostname of who to connect to here con_Ip - Label - displaying the IP you are connect to. (only works partially) con_port - Label - displaying the port you are connected to always 2100. l_stat - Label - displaying the current connection status. (only works partially) b_discon - CommandButton - Disconnect button b_sendout - CommandButton - Send button b_con - CommandButton - Connect button



Reply With Quote