Here's a little test program
Hello and thanks for your will to help me. I have put together a little test program that simulates incoming and outgoing messages.
Option Explicit
Const Red = &HFF&
Const Blue = &HFF0000
Dim t As String
Dim f As String
Private Sub txt1_KeyPress(KeyAscii As Integer)
f = "from: "
If KeyAscii = 13 Then
With rtftest
.SelLength = Len(txt1.Text)
.SelColor = Blue
.SelBold = True
.TextRTF = rtftest.Text & vbNewLine & f & txt1.Text
.SelStart = Len(rtftest.Text)
.SelBold = False
End With
txt1.Text = ""
txt2.SetFocus
End If
End Sub
Private Sub txt2_KeyPress(KeyAscii As Integer)
t = "to: "
If KeyAscii = 13 Then
With rtftest
.SelLength = Len(txt2.Text)
.SelColor = Red
.TextRTF = rtftest.Text & vbNewLine & t & txt2.Text
.SelStart = Len(rtftest.Text)
End With
txt2.Text = ""
txt1.SetFocus
End If
End Sub
What happen is that when I send one outgoing message to RTB it format it like it should but then I send the next incoming message and then it changes the whole RTB content to the new format.
Can I somehow keep the format to a separate line???
This is the main problem. Hope there is a solution and some of you know about it. I would be most greatful.
ps. Do I need a error routine in this proceedure, do you think??
Best regards