|
-
Nov 22nd, 2000, 06:34 PM
#1
Thread Starter
New Member
Hello every body.
I have some problem with my chatprogram. I would like to have a richtextbox so that I can get incoming messages in a different color, font and I like it bold and italic. I would also like to get the next message at a new row.
I've tried a lot of ways, I can get it bold and italic but the color doesn't change with .SelColor. If I use a loop I can get different colors but the first word always stays black or default color.
I've tried vbCrLf to get it to change row but that doesn't work either. I have also tried Chr(10) & Chr(13), it failed too.
Can anybody help me??
Does anybody know about a site that explains the rtb and all its programming secrets??
I would be most grateful if I could get some help.
Best regards
Maxon
-
Nov 23rd, 2000, 01:11 AM
#2
Conquistador
For a new line:
Code:
rtb1.Text = rtb1.Text & vbNewLine & "Hello"
-
Nov 23rd, 2000, 03:11 AM
#3
Thread Starter
New Member
thank you
Thank you very much. One problem less.
Best regards
-
Nov 23rd, 2000, 04:35 AM
#4
Conquistador
could you show me the code which u r using to attempt the change of color? then i might be able to help some more.
-
Nov 23rd, 2000, 08:42 AM
#5
Addicted Member
send the server like a code to make it bold like /txtb that whould be helpfully mite me a hard way but an easy way at the same time
WHat would we do with out Microsoft.
A lot more.
-
Nov 23rd, 2000, 04:25 PM
#6
Thread Starter
New Member
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
-
Nov 23rd, 2000, 07:02 PM
#7
To add a new line to the cursor position.
Code:
RTB.SetFocus
RTB.SelText = vbNewLine
-
Nov 24th, 2000, 02:12 AM
#8
Thread Starter
New Member
Thank you. All suggestions are welcome. I will try that out.
Best regards
-
Nov 24th, 2000, 09:06 PM
#9
Conquistador
you shouldn't mix .TextRTF and .Text
i can't work out how it should be done either.
-
Nov 25th, 2000, 03:00 AM
#10
Thread Starter
New Member
Hello. I would like to thank you for trying.
Well, I will keep on trying and I let you know if I solve the problem.
For now
-
Nov 25th, 2000, 10:48 AM
#11
Originally posted by da_silvy
you shouldn't mix .TextRTF and .Text
i can't work out how it should be done either.
TextRTF sets the text of a RichTextBox control, including all .RTF code
-
Nov 25th, 2000, 11:33 PM
#12
Conquistador
yeah, but if you add .text to .textrtf it doesn't keep it's formatting....
-
Nov 26th, 2000, 05:44 PM
#13
Thread Starter
New Member
Keep on learning
Hello again. I will try to replace all text with textRTF and I will let you know if I succed. I will go to the university library tomorrow and see if they got any books that will reveal any secrets about RTB. I'll let you know.
Best regards
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|