I have been working on a app and currently have got it working the user can set there font color so i want when the user sends the text it also send the color as well
heres the code i use to collor the text
vb Code:
Private Sub DisplayT(ByVal text As String) Dim sto As String sto = "You say: " Dim selectionStart As Integer = txtDisplay.TextLength txtDisplay.AppendText(sto) txtDisplay.SelectionStart = selectionStart txtDisplay.SelectionLength = sto.Length txtDisplay.SelectionColor = Color.Green stoco(text) End Sub Sub stoco(ByVal text As String) Dim selectionStart As Integer = txtDisplay.TextLength txtDisplay.AppendText(text) txtDisplay.SelectionStart = selectionStart txtDisplay.SelectionLength = text.Length txtDisplay.SelectionColor = txtSend.ForeColor txtDisplay.AppendText(Environment.NewLine) End Sub
and heres the code i use to send the text to the server
vb Code:
If txtSend.Text <> "" Then DisplayT(txtSend.Text) SendData("CHAT|" & txtSend.Text) txtSend.Text = "" End If
vb Code:
Public Sub SendData(ByVal data As String) Dim writer2 As New IO.StreamWriter(client.GetStream) writer2.Write(data & vbCr) writer2.Flush() End Sub





Reply With Quote